$(document).ready(function(){ // Init ScrollMagic var controller = new ScrollMagic.Controller(); // Build a scene - to fade-in elements of intro on homepage var ourScene = new ScrollMagic.Scene({ triggerElement: '.navbar-default', triggerHook:0, reverse:false }) .setClassToggle('#intro', 'fade_in') // add class fade in to intro on homepage /* .addIndicators({ name: 'fade-in intro', colorTrigger: 'red', colorStart: '#75C695' }) // this requires a plugin */ .addTo(controller); // build scene2 - to display fixed nav bar on scroll down on homepage var ourScene2 = new ScrollMagic.Scene({ triggerElement: '#main', triggerHook:0.8, }) .setClassToggle('.navbar-default', 'fade_in') // add class fade in to navbar /* .addIndicators({ name: 'fade-in navbar', position:200, colorTrigger: 'blue', colorStart: '#75C695', }) // this requires a plugin */ .addTo(controller); // build scene3 - to fadeout intro content when we start to scroll down on homepage var ourScene2 = new ScrollMagic.Scene({ triggerElement: '#main', triggerHook:0.8, }) .setClassToggle('.content', 'fade_out') // add class fade-out to intro content /* .addIndicators({ name: 'fade-out intro', colorTrigger: 'red', colorStart: '#75C695' }) // this requires a plugin */ .addTo(controller); // generic code for parallax scenes // loop through each .product_details elements to animate product overview $('.parallax').each(function(){ var parallaxTl = new TimelineMax(); var idx = $(this).data('idx'); if (!idx) return; var content_wrapper =".content_wrapper"+idx; var bcg =".bcg"+idx; var bcg_parallax =".bcg_parallax"+idx; parallaxTl .from(content_wrapper, 0.4, {autoAlpha: 0, ease:Power0.easeNone}, 0.4) .from(bcg, 2, {y: '-50%', ease:Power0.easeNone}, 0) ; var slideParallaxScene = new ScrollMagic.Scene({ triggerElement: bcg_parallax, triggerHook: 0.9, duration: '100%' }) .setTween(parallaxTl) .addTo(controller); }); // loop through each .project element on homepage $('.project').each(function(){ // build a scene var ourScene = new ScrollMagic.Scene({ triggerElement: this.children[0], triggerHook: 0.9 }) .setClassToggle(this, 'fade-in') // add class to project /* .addIndicators({ name: 'fade scene', colorTrigger: 'black', colorStart: '#75C695', colorEnd: 'pink' }) // this requires a plugin */ .addTo(controller); }); //jQuery for page scrolling up from footer - requires jQuery Easing plugin $(function() { $('.sep_block_up a').bind('click',function(event){ var $anchor = $(this); $('html, body').stop().animate({ scrollTop: $($anchor.attr('href')).offset().top }, 1500,'easeInOutExpo'); event.preventDefault(); }); }); });