( function( $ ) { $(document).ready(function(){ if (window.matchMedia('(min-width: 768px)').matches) { /* ------ Animation des sections ------ */ function sectionMove(){ $('.theme-name').transition({ top: 0, left: 0, opacity: 1 }, 750, 'ease'); $('#header-nav').transition({ top: 0, right: 0, opacity: 1 }, 750, 'ease'); $('aside').transition({ bottom: 0, left: 0, opacity: 1 }, 750, 'ease'); $('section').transition({ bottom: 0, right: 0, opacity: 1 }, 750, 'ease'); } function sliderDown(){ $('.slider').slideDown(750); } sectionMove() /* ------ Apparition des .post ------ */ windowHeight = $(window).height(); $('.post').each(function(){ if ( $(this).offset().top < ( windowHeight - 100 )) { $(this).transition({ opacity: 1 }); $(this).find('.post-format').transition({ top: 0, left : 0 }); $(this).find('.post-title-box').transition({ top: 0, right : 0 }); $(this).find('.post-side').transition({ bottom: 0, left : 0 }); $(this).find('.post-content-box').transition({ bottom: 0, right : 0 }); } }); scrollTop = $('body').scrollTop(); $('.post').each(function(){ postPosition = ($(this).offset().top); }); $(window).scroll(function(){ scrollTop = $('body').scrollTop(); $('.post').each(function(){ postPosition = $(this).offset().top; if((scrollTop + ( windowHeight - 200 ) ) >= (postPosition)) { $(this).css({ opacity: 1, }); $(this).find('.post-format').transition({ top: 0, left : 0 }); $(this).find('.post-title-box').transition({ top: 0, right : 0 }); $(this).find('.post-side').transition({ bottom: 0, left : 0 }); $(this).find('.post-content-box').transition({ bottom: 0, right : 0 }); } }); }); /* ------ Apparition des .slide-captions ------ */ $('.slide-caption').transition({ opacity: 1, left: '50%' }, 750, 'ease'); } if (window.matchMedia('(max-width: 768px)').matches) { $('#burger').click(function(){ $('.menu').slideToggle(); }); } }); } )( jQuery );