$( () => { var wait=true; $(window).scroll(function(){ if(wait==true){ $('link[rel=css]').attr("rel","stylesheet"); wait=false; } }); $("body").mouseover(function(){ if(wait==true){ $('link[rel=css]').attr("rel","stylesheet"); wait=false; } }); $('nav ul').before(''); $("head").append(''); if($("#site_list").length==0){ $("head title").before(''); $("#site_list").load('js/site_list.js'); } var cPage = $("h1").parents("div").attr("class"); var Task=""; function ChV(){ if(!$("#content_wrap").length){ var wt=$(window).scrollTop(); if(wt > 100){ $('nav').addClass('navShadow'); $("#top_content h2").fadeOut(); }else{ $('nav').removeClass('navShadow'); $("#top_content h2").fadeIn(); } } if($(".read_nera").length){ var wt=$(window).scrollTop(); var vh=$(window).height()/4; var fh=$("#flow").offset().top-$(window).height(); if(wt>vh && wt So){ T=$(this).attr("id").replace("#",""); $(this).addClass("active"); }else if(wt < So-300){ $(this).removeClass("active"); } if($(this).attr("id")=="about"){ $("#about .topics").each(function(){ var Th=$(this).height()*2; var St=$(this).offset().top-Th; if(wt > St){ $(this).addClass("tactive"); }else if(wt < St){ $(this).removeClass("tactive"); } }); } if($(this).attr("id")=="flow"){ $("#flow li").each(function(){ var Th=$(this).height(); var St=$(this).offset().top; if(wt > St){ $(this).addClass("factive"); }else if(wt < St){ $(this).removeClass("factive"); } var Su=St+Th; if(wt > Su){ $(this).removeClass("factive"); } }); } }); if($("#works").attr("class")=="active"){ var Wh=$("#works").height(); var Wo=$("#works").offset().top; if(wt < Wo-Wh){ $(".to_works").fadeIn(); $("#works").removeClass("active").fadeOut(); } } $("nav ul").attr("rel",T); if(cPage!="contents_head"){ if(Task != T){ if(T!=""){ var Title = $("#"+T+" h2").text(); $('title').text(Title+' | anturé - アントゥーレ -'); history.pushState('','',"#"+T); }else{ $('title').text('anturé - アントゥーレ -'); history.pushState('','','./'); } Task=T; } } if(T=="about"){ $("#about .topics").each(function(){ var Lih = $(this).offset().top - $(this).height(); if(wt > Lih){ tID = $(this).attr("id").replace("top_",""); $("#topics_navi").attr("rel",tID); } }); } if(T=="flow"){ $("#topics_navi").attr("rel","out"); $(".flow_text,#flow_navi,#walking,.flow_type").css({"position":"fixed"}).fadeIn(); var Now = $('#walking').attr("class"); var Step=""; if($('.factive').length){ Step=$('.factive').attr("rel").replace("step",""); }else{ Step=1; } $("#flow_navi").attr("class","step"+Step); if(Step=="5" || Step=="6"){ if(Now!="run"){ $('#walking').attr('class',"run"); } }else if(Step=="3" || Step=="4"){ if(Now!="walk"){ $('#walking').attr('class',"walk"); } }else{ if(Now!="stop"){ $('#walking').attr('class',"stop"); } } if($(".select_flow").length){ $("#flow_navi li").fadeIn(); } }else{ $("#flow #walking,#flow .flow_text,#flow_navi,.flow_type").css({"position":"absolute"}).fadeOut(); } $('#menu').removeClass('open_menu'); var vh = $(window).height()-100; $("#topics_navi li a").css({"width":vh/6+"px","margin-left":"-"+vh/10+"px"}); } ChV(); $(window).scroll( () => { ChV(); }); var scrollPosition; function bodyFixedOn() { $('body').css('overflow', 'hidden'); } function bodyFixedOff() { $('body').css('overflow', '').attr('rel',''); } $('h1 a').on('click', () => { if(cPage!="contents_head"){ $("#op_box").fadeOut(function(){$(this).remove();}); $("#content_wrap").animate({"left":"100%"},function(){ $(this).remove(); }); $('html,body').animate({ scrollTop: 0 },500); $("section").removeClass("active"); $("nav ul").attr("rel",""); bodyFixedOff(); return false; } }); $('nav a[href*="#"]').on('click', function(e){ var Title =$(this).text(); var ID = $(this).attr('href'); console.log(Title); if(cPage!="contents_head"){ $("#content_wrap").animate({"left":"100%"},function(){ $(this).remove(); }); $("#op_box").fadeOut(function(){$(this).remove();}); $("nav ul").attr("rel",ID.replace("#","")); $('html,body').animate({ scrollTop: $(ID).offset().top - 50 },500); e.preventDefault(); bodyFixedOff(); return false; }else{ if(ID!="" && ID!=null){ location.href="./"+$(this).attr('href'); } } }); $('#menu').on('click', () => { $('#menu').toggleClass('open_menu'); if(cPage!="contents_head"){ if($('#menu').attr('class')=="open_menu"){ if($('.subNav').length==0){ var subNav=$("#topics_navi").html(); $.when( $('#menu+ul').find('li').eq(0).append('