A semantic search engine for source code https://bitshift.benkurtovic.com/
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

16 行
384 B

  1. var lastVertPos = $(window).scrollTop();
  2. function parallax(){
  3. var currVertPos = $(window).scrollTop();
  4. var delta = currVertPos - lastVertPos;
  5. $(".bg").each(function(){
  6. $(this).css("top", parseFloat($(this).css("top")) -
  7. delta * $(this).attr("speed") + "px");
  8. });
  9. lastVertPos = currVertPos;
  10. }
  11. $(window).scroll(function(e){
  12. parallax();
  13. });