发布于 2018-09-11 14:06:02
首先要做的是。您所引用的站点没有使用任何滚动事件。在Chrome中打开站点并打开开发工具。然后将视图设置为mobile (或tablet,相同的内容)。如果你在Chrome上使用移动模式,那么你的鼠标就像一只真正的智能手机上的手指。根据这种逻辑,你用鼠标在屏幕上的“滑动”应该会触发滚动事件,但它不会触发,因此,触发花哨动画的并不是实际的滚动。
我相信弗勒·莫罗使用了一个“鼠标轮”事件侦听器来触发动画。
var link = document.querySelector('body');
link.addEventListener('mousewheel', function (event) {
// Prevent the link from updating the URL
event.preventDefault();
// Do something...
console.log('Triggering fancy animations!')
}, false);或者如果您使用jquery
$('body').on('mousewheel',function(event){
// Prevent the link from updating the URL
event.preventDefault();
// Do something...
console.log('Triggering fancy animations!')
});祝你的项目顺利
https://stackoverflow.com/questions/52277040
复制相似问题