【发布时间】:2014-06-23 13:16:47
【问题描述】:
我有一个网站上有一个<div> 可以垂直滚动。效果很好。我也隐藏了滚动条,这也很好用。 CSS本质上是
.scrollable {
overflow-y: scroll;
-ms-overflow-style: none;
}
不过,我目前在 Internet Explorer 11 和 Windows 7 的触控显示器上遇到了问题。当用户点击滚动底部的顶部时,窗口会弹跳(即过度滚动)。虽然这对大多数用户来说只是一个烦恼,但这是在信息亭中全屏运行,因此 overscoll 允许桌面窥视(不仅仅是浏览器背景)。
我一直未能找到解决此问题的方法。 touch-action(加前缀和不加前缀),例如
html, body, .scrollable {
-ms-touch-action: none;
touch-action: none;
}
似乎什么也没做,也没有
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
document.addEventListener('MSPointerMove', function (e) { e.preventDefault(); }, false);
This jsBin 显示问题。
那么,在 IE11 / Windows 7 中防止过度滚动的正确方法是什么。
【问题讨论】:
-
最近 overscroll-behavior 被添加到 Firefox 59 和 Chrome 65 并将添加到 Edge 18。
标签: javascript css internet-explorer windows-7 internet-explorer-11