Javascript jQuery scrollTop()不';我不在野生动物园工作
我使用这个函数来分块加载网页,以减少主页的页面加载时间 这在chrome和UC浏览器中运行良好。只有safari浏览器出现了问题 这是我的代码:Javascript jQuery scrollTop()不';我不在野生动物园工作,javascript,jquery,ajax,Javascript,Jquery,Ajax,我使用这个函数来分块加载网页,以减少主页的页面加载时间 这在chrome和UC浏览器中运行良好。只有safari浏览器出现了问题 这是我的代码: if($(window).scrollTop() + $(window).height() == $(document).height()) //user scrolled to bottom of the page? { } 当我要提醒循环中的某些东西时,它在iphone中也不起作用。 指引我哪里做错了什么 谢谢。我记得,safa
if($(window).scrollTop() + $(window).height() == $(document).height()) //user scrolled to bottom of the page?
{
}
当我要提醒循环中的某些东西时,它在iphone中也不起作用。
指引我哪里做错了什么
谢谢。我记得,safari的jquerys窗口高度有问题。 请尝试
window.innerHeight
。所以你的代码看起来像这样
if($(window).scrollTop() + window.innerHeight == $(document).height()) {
alert('bottom')
}
Mephiztopheles:很好..我还可以检查一下卷轴是否在底部上方很小。这样加载程序将在滚动触底之前调用。这类似于
$(窗口).scrollTop()+窗口.innerHeight>=$(文档).height()-BUFFER
。。。我希望如此:D没有检查它,但它应该是这样编辑的:您需要=
,因为您无法准确地滚动该值。。。因此,在滚动时将触发函数。。每个滚动事件。。。还记得你是怎么用的吗?你有小提琴给我吗?然后我可以检查一下,也许可以帮你:)