Advertisement
srikat

Untitled

Jun 9th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. jQuery(function( $ ){
  2.  
  3. // Enable parallax on homepage sections
  4. $(window).scroll(function(){
  5.  
  6.  
  7. scrolltop = $(window).scrollTop()
  8. scrollwindow = scrolltop + $(window).height();
  9.  
  10. // Intro section
  11. $("hero-section").css("backgroundPosition", "0px " + -(scrolltop/6) + "px");
  12.  
  13.  
  14. // Service section
  15. if( scrollwindow > $("#services").offset().top ) {
  16.  
  17. backgroundscroll1 = scrollwindow - $("#services").offset().top;
  18. $("#services").css("backgroundPosition", "0px " + -(backgroundscroll1/6) + "px");
  19.  
  20. }
  21.  
  22. // Testimonials section
  23. if( scrollwindow > $("#testimonial").offset().top ) {
  24.  
  25. backgroundscroll2 = scrollwindow - $("#testimonial").offset().top;
  26. $("#testimonial").css("backgroundPosition", "0px " + -(backgroundscroll2/6) + "px");
  27.  
  28. }
  29.  
  30.  
  31. });
  32.  
  33. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement