📜  como fazer elementos que scroll diferente - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:33.593000             🧑  作者: Mango

代码示例1
$(window).scroll(function(e){
  parallax();
});
function parallax(){
  var scrolled = $(window).scrollTop();
  $('.bg').css('top',-(scrolled*0.2)+'px');
}