A semantic search engine for source code https://bitshift.benkurtovic.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
507 B

  1. /*
  2. * @file Implements a parallax effect on the about page.
  3. */
  4. var lastVertPos = $(window).scrollTop();
  5. /*
  6. * Scroll `div#img-[1-4]` at a greater speed than the text, producing a
  7. * parallax effect.
  8. */
  9. $(window).scroll(function(e){
  10. var currVertPos = $(window).scrollTop();
  11. var delta = currVertPos - lastVertPos;
  12. $(".bg").each(function(){
  13. $(this).css("top", parseFloat($(this).css("top")) -
  14. delta * $(this).attr("speed") + "px");
  15. });
  16. lastVertPos = currVertPos;
  17. });