滚动从数据库加载更多数据在 IE 11 中不起作用
On scroll load more data from database not working in 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 上测试了您的代码示例并且运行良好。这是浏览器中的测试代码 i 运行:
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 上运行。
我尝试在滚动到底部时加载更多数据。在 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 上测试了您的代码示例并且运行良好。这是浏览器中的测试代码 i 运行:
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 上运行。