![](/img/trans.png)
[英]Why is Infinite scrolling not working when I scroll bottom, instead it triggers on scroll top?
[英]Windows scroll working on scrolling to the top instead of bottom
嘗試在滾動到底部時激活自動加載功能時遇到了挑戰。 問題是,當我滾動到底部時,jQuery不起作用,但是當我滾動回到頂部時,它起作用了。
我嘗試在1.8.3而不是我正在使用的1.11.1上進行測試,但這兩個實際上已壓縮。
我是jQuery的新手,非常感謝任何可以幫助我的人。 但是,我嘗試在另一台計算機上測試自動加載,效果很好。
下面是代碼
function auto_loader(){
$(window).scroll(function()
{
if($(window).scrollTop() + $(window).height() == $(document).height())
{
// load your content
alert("\ola");
}
});
}
我一直這樣做:
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
// Bottom of page
}
小提琴: http : //jsfiddle.net/tq0kxkhs/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.