jasonglisson
11/21/2014 - 5:58 PM

Javascript - Parallax Windows Scroll

Javascript - Parallax Windows Scroll

$(window).bind('scroll',function(e){
    parallaxScroll();
});

function parallaxScroll(){
	var scrolled = $(window).scrollTop();
	$('#fifty').css('background-position-y', ((scrolled*.20))+'px');	
	$('#services-0').css('background-position-y', ((scrolled*.04))+'px');		
	$('#services-3').css('background-position-y', ((scrolled*.03))+'px');
	$('#services-8').css('background-position-y', ((scrolled*.02))+'px');				
}


$(window).scroll(function() {
    if ($(this).scrollTop() > 200) {
        $('.top-header #menu-background').fadeIn();
        $('.top-header #mobile-menu-background').fadeIn(); 
        $('#back-to-top').fadeIn();    
/*         $('#logo').height(76);  */
        $('#container').addClass('reduce');                                  
    } else {
        $('.top-header #menu-background').fadeOut();
        $('.top-header #mobile-menu-background').fadeOut();        
        $('#back-to-top').fadeOut();   
/*         $('#logo').height(108);  */  
        $('#container').removeClass('reduce');                                 
    }  
    if ($(this).scrollTop() > -400) {
        $('.about-image').addClass('animated fadeInRight fade');       
    
    }    
});