jQuery.event.add(window,"load",function() { indexAnimation(); load_effect(); $(window).scroll(function (){ scroll_effect(); gnav_grayish(); //mvをdisplay: none; var windowHei = $(window).height(); var scrollPos = $(window).scrollTop(); if ( scrollPos > windowHei ) { $('#index-mv').fadeOut(); } else { $('#index-mv').fadeIn(); } }); }); //ふわっとロード function load_effect(){ var tt = $(window).scrollTop(); var hh = $(window).height(); $('.load-fade').each(function(){ var yy = $(this).offset().top; if (tt > yy - hh){ $(this).addClass('done'); } }); $('.load-up').each(function(){ var yy = $(this).offset().top; if (tt > yy - hh){ $(this).addClass('done'); } }); $('.scroll-fade').each(function(){ var yy = $(this).offset().top; if (tt > yy - hh){ $(this).addClass('done'); } }); $('.scroll-up').each(function(){ var yy = $(this).offset().top; if (tt > yy - hh){ $(this).addClass('done'); } }); } //ふわっとスクロール function scroll_effect(){ var tt = $(window).scrollTop(); var hh = $(window).height(); $('.scroll-fade').each(function(){ var yy = $(this).offset().top; if (tt > yy - hh){ $(this).addClass('done'); } }); $('.scroll-up').each(function(){ var yy = $(this).offset().top; if (tt > yy - hh){ $(this).addClass('done'); } }); $('.scroll-roll').each(function(){ var yy = $(this).offset().top; if (tt > yy - hh){ $(this).addClass('done'); } }); } //headerにグレー付与 function gnav_grayish(){ var tt = $(window).scrollTop(); if (tt > 0){ $('header').addClass('grayish'); } else { $('header').removeClass('grayish'); } } // aimation関数 function indexAnimation() { $(".load-anim").each(function () { $(this).addClass('is-animated'); }); }