Advertisement
srikat

parallax.js

Jan 24th, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery(function( $ ){
  2.  
  3.     // Enable parallax and fade effects on homepage sections
  4.     $(window).scroll(function(){
  5.  
  6.  
  7.         scrolltop = $(window).scrollTop()
  8.         scrollwindow = scrolltop + $(window).height();
  9.  
  10.         //$(".home-top-wrap").css("backgroundPosition", "0px " + -(scrolltop/6) + "px");
  11.  
  12.          if( scrollwindow > $(".home-top-wrap").offset().top ) {
  13.  
  14.             // Enable parallax effect
  15.              backgroundscroll = scrollwindow - $(".home-top-wrap").offset().top;
  16.              $(".home-top-wrap").css("backgroundPosition", "0px " + -(backgroundscroll/6) + "px");
  17.  
  18.          }
  19.  
  20.          if( scrollwindow > $(".home-last-wrap").offset().top ) {
  21.  
  22.             // Enable parallax effect
  23.              backgroundscroll = scrollwindow - $(".home-last-wrap").offset().top;
  24.              $(".home-last-wrap").css("backgroundPosition", "0px " + -(backgroundscroll/6) + "px");
  25.  
  26.          }
  27.  
  28.  
  29.     });
  30.  
  31. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement