pepel_xD Asked:2022-03-16 14:35:37 +0800 CST2022-03-16 14:35:37 +0800 CST 2022-03-16 14:35:37 +0800 CST 在移动浏览器中向下滑动时页面重新加载 772 在移动浏览器中,实现了这样一个功能,如果您从上到下滑动,同时滚动在正确的位置,则页面将重新加载。 我看到了一个类似的问题,但是作者overflow: hidden在标签上使用了拐杖body。我对取消此操作的更正确的解决方案感兴趣。 javascript 1 个回答 Voted Best Answer 2ip 2022-03-24T00:55:58+08:002022-03-24T00:55:58+08:00 我得到了这个解决方案: var lastY = 1; document.addEventListener("touchmove", function (event) { var lastS = document.documentElement.scrollTop; if(lastS == 0 && (lastY-event.touches[0].clientY)<0 && event.cancelable){ event.preventDefault(); event.stopPropagation(); } lastY = event.touches[0].clientY; },{passive: false});
我得到了这个解决方案: