5

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.

Nikola
  • 339
  • 4
  • 8
  • This should probably be `>=` instead of `==` to catch UIs that push past and bounce back... like the iPhone? – mVChr Jan 22 '11 at 18:02

2 Answers2

5

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

($(window).scrollTop() + 60 == ($(document).height() - $(window).height()) 
eykanal
  • 26,437
  • 19
  • 82
  • 113
Dan Jenns
  • 51
  • 1
  • 2
3
var wintop = $(window).scrollTop(), docheight = $(document).height(), winheight = $(window).height();
        var  scrolltrigger = 0.90;

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

            //Your AJAX CALL HERE
        }
    });
Andro Selva
  • 53,910
  • 52
  • 193
  • 240
Marco Ramires
  • 1,116
  • 1
  • 10
  • 19