jQuery scrollTop()在Safari中不起作用

时间:2014-10-31 07:46:34

标签: javascript jquery ajax

我正在使用此功能在Chunks中加载网页,以减少主页的页面加载时间。

这在Chrome和UC浏览器中运行良好。只有问题出现在safari浏览器中。

这是我的代码:

if($(window).scrollTop() + $(window).height() == $(document).height())  //user scrolled to bottom of the page?
        {
}

当我要在循环中提醒某些内容时,它也无法在 iphone 中工作。 指导我在哪里做错了。

感谢。

1 个答案:

答案 0 :(得分:4)

我记得,那个safari有一个jquerys窗口高度的问题。 请尝试window.innerHeight 所以你的代码看起来像这样

if($(window).scrollTop() + window.innerHeight == $(document).height()) {
    alert('bottom')
}
相关问题