html - 启用滚动触摸 IE
问题描述
在我的网站中,我遇到了这个问题:
如果设备有触摸屏,我希望所有页面都是可滚动的。我的网站遇到了 IE
我尝试touch-action pan-y
在我的主要 div 上申请,但没有结果。
解决方案
将样式添加到 html 文档的头部
<style>.tst{overflow: hidden;}</style>
Add this line in body tag
<body class="tst" onload ="NoScroll()">
//content here
在脚本标签中添加这个
function noScroll() {
var page = document.getElementsByTagName("body")[0];
if ('ontouchstart' in document.documentElement) {
console.log("touch device detected");
page.classList.remove("tst");
}
else{
console.log("desktop mode");
page.classList.add("tst");
}
}
推荐阅读
- r - 数据表中最常见的
- javascript - 从特定数据重新排序数组
- javascript - 等待 DOM 元素然后做出反应 - Reactjs
- debugging - 正确使用 DEBUG_NEW
- python - 如何在 Tkinter 中格式化来自 Text Widget 的文本输入
- ansible - 如何为 ansible 变量提供选项卡空间
- http - Google Cloud Text to Speech - 为什么通过 Go 客户端库和 REST API 的请求之间存在延迟差异?
- doctrine-orm - 如何在 TYPO3 中注册 DQL 函数
- weblogic - 如何启用 Weblogic 托管服务器 ResolveDNSName?
- angular - 重新排序视图的子项。Nativescript Angular