javascript - Scroll is not working for ie 11 sharepoint 2013
问题描述
I am trying to get the scroll position, the scroll is working in all the browser except ie 11.0
I have tried the below code this is not firing any event
window.onscroll = function () {
console.log("Test");
};
解决方案
此问题与 IE 浏览器和 SharePoint 有关吗?
您上面的代码示例不足以重现问题。
我尝试使用此示例代码进行测试,看起来它在 IE 11 浏览器上运行良好。
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
#show {
display:block;
position:fixed;
top:0px;
left:300px;
}
</style>
</head>
<body>
<pre id="repeat"></pre>
<div style="position:relative;">
<div id="show">x</div>
</div>
<script>
var elem = document.getElementById('repeat');
var show = document.getElementById('show');
for (i = 1; i <= 300; i++) {
elem.innerHTML += i + "<br/>";
}
window.onscroll = function () {
show.innerHTML = document.documentElement.scrollTop || document.body.scrollTop;
};
</script>
</body>
</html>
IE 11 中的输出:
参考:
如果您的问题仍然存在,请尝试提供一个清晰的示例,其中包含可能产生问题的详细步骤。我们将尝试对其进行测试以检查结果。
推荐阅读
- apache-spark - 如何在 Spark 中获取 hive 表的分区信息
- emscripten - 重写 python 脚本运行器浏览器并使用内联 (./emcc ...) 命令构建单个 emscripten 测试用例
- reactjs - 如何将来自 RTSP url 的 IP 摄像机源显示到 reactjs 应用程序页面上?
- php - 如何使用 wordpress 托管 gatsby?
- linux - 如何在 Amazon Linux AMI 中安装 Postgresql 11?
- qt - 通过 QT 应用程序中的代理订阅 OneSignal 中的用户
- c++ - 在 lua 中加载 C++ 模块时出现“尝试索引字符串值”错误
- reactjs - 取消选中带有 Material UI 的单选按钮
- json - 仅使用 Ruby 生成 HTML 安全 JSON
- elasticsearch - 弹性搜索 | 如何获取具有相应匹配值的原始搜索查询