javascript - 滚动时从数据库中加载更多数据在 IE 11 中不起作用
问题描述
我尝试在滚动到底部时加载更多数据。在 Edge、Chrome、Firefox 中一切正常,但在 IE 11 中却不行。那里没有任何反应
这是我的代码:
$(window).scroll(function() {
if ($(document).height() <= $(this).scrollTop() + $(this).height()) {
if (timer) {
window.clearTimeout(timer);
}
timer = window.setTimeout(function() {
// Magic goes here
}, 400);
}
});
元标记设置为
<meta http-equiv="X-UA-Compatible" content="IE=edge">
很多谢谢
编辑
如果我在 IE 上打开调试模式,一切正常。没有错误
解决方案
刚刚在 IE11 上测试了您的代码示例,并且运行良好。这是我在浏览器中运行的测试代码:
var timer;
$(window).scroll(function(){
if ($(document).height() <= $(this).scrollTop() + $(this).height()) {
if(timer) {
window.clearTimeout(timer);
}
timer = window.setTimeout(function() {
alert('bottom of page');
});
}
});
在 IE11 上的控制台中是否有任何错误?分享更多有问题的代码会有所帮助,因为您给出的示例没有内在的理由不能在 IE11 上运行。
推荐阅读
- javascript - 如何使用Javascript更改元素的文本而不消失?
- html - 如何在 HTML 中创建嵌套表格
- c# - 如何在 ASP.NET Web 应用程序中只加载一次数据表中的静态数据
- swift - Swift 中 flatMap 的定义
- firebase - Flutter 和 Firebase:动态推送通知,例如 Whatsapp
- c++ - 与 asm volatile 相比,我们需要使用一些运行时内存围栏机制
- html - 如何让 div 部分覆盖其他样式代码?
- javascript - 他们是一种基于多边形属性禁用少数多边形交互的方法吗?
- google-apps-script - 谷歌表格 - 如何通过选择不同的单元格来触发一个或多个单元格的背景颜色变化?
- swift - 自定义合并 RateLimitedScheduler