iPhone and iPad end of scrolling

2019-04-30 00:25发布

I'm making some jQuery cross-browser gallery with infinite scroll i works great but on iPhone (i suppose also on iPad) instead equal values i have some disproportion values don't match

($(window).scrollTop() == ($(document).height() - $(window).height()) 

i just want to reach the end of scrolling on that , after that i could invoke AJAX script, also have to keep in mind that values changing after two fingers wipe zoom.

2条回答
Explosion°爆炸
2楼-- · 2019-04-30 00:36
var wintop = $(window).scrollTop(), docheight = $(document).height(), winheight = $(window).height();
        var  scrolltrigger = 0.90;

        if  ((wintop/(docheight-winheight)) > scrolltrigger) {

            //Your AJAX CALL HERE
        }
    });
查看更多
虎瘦雄心在
3楼-- · 2019-04-30 00:51

You need to account for the 60px URL text field on iPhone. Try this:

($(window).scrollTop() + 60 == ($(document).height() - $(window).height()) 
查看更多
登录 后发表回答