gpt4 book ai didi

css - 在 Metro IE 中禁用导航滑动

转载 作者:行者123 更新时间:2023-11-28 09:37:46 25 4
gpt4 key购买 nike

我正在尝试禁用导航滑动。我不希望网页在用户向左或向右滑动时后退或前进。

我注意到我们可以在 html 元素上将 touch-action 设置为 none 以防止该行为。但是,当滚动有溢出的子元素时,它将“链接”滚动然后允许向后导航。

所以我想在 html 元素上添加 -ms-scroll-chaining: none ,但只有当元素滚动时它才有效。所以在 html 上添加 overflow: scroll 实际上就可以了。但现在我的其他浏览器上显示了滚动条。

正确的做法是什么?

    html {
-ms-touch-action: none; /* Doesn't work if scrolling from child element */
-ms-scroll-chaining: none; /* Works only with the next line */
overflow: scroll; /* With this line all the other browsers have a scrollbar */
}

最佳答案

我用过这个:

@media screen and (-ms-high-contrast: none) {
// Windows 8+ IE only
html {
overflow-x: scroll;
-ms-touch-action: none;
-ms-overflow-style: none;
-ms-scroll-chaining: none;
}
}

关于css - 在 Metro IE 中禁用导航滑动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19104624/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com