我试图让页面在向下滚动时水平滚动(例如 - http://hotdot.pro)但是我能看到的唯一可用的脚本却会继续滚动,我知道它为什么会继续滚动但是我想要正确编码一些帮助:) JSFiddle - https://jsfiddle.net/0aks9u5d/
var xyz = 1;
$(document).scroll(function() {
var scrollD = $(document).scrollTop();
xyz= xyz+1;
console.log(xyz);
$("html, body").scrollLeft(xyz);
$("html, body").scrollTop(0);
});
任何帮助都很棒谢谢!
答案 0 :(得分:1)
你得到的是无限递归循环。
$("html, body").scrollLeft(xyz)
会触发您的$(document).scroll(function(){...})
事件。事件正文$("html, body").scrollLeft(xyz)
再次触发$(document).scroll(function(){...})
。等等...