[jQuery] Cross Browser variance in scrollTop related calculation?
To determine if the document's vertical scroll bar is at the "bottom"
of its travel, I've seen this calculation:
delta = $(document).height() - $(window).height();
scrollTopIsAtMax = ($(window).scrollTop() == delta);
As the document's scroll bar is scrolled down, the value of $
(window.scrollTop()) increases until it equals the value of delta,
signifying the scrollbar is at the bottom end of its travel.
Using jquery-nightly.js for June 28/08 with the DOCTYPE in strict mode
I get the following when the scrollbar is at the bottom of its travel
(all windows maximized):
IE7 FFox3
Safari3.1.2(win) Opera9.5
$(document).height() 1170 1015
1006 896
$(window).height() 626 583
634 880
delta 544 432
372 16
$(window).scrollTop() 544 432
372 237
scrollTopIsAtMax true true
true false
jQuery browser info msie7.0 mozilla1.9 safari525.19
opera9.50
As you can see, this algorithm doesn't work for Opera. Is there a
more jQueryesq way to determine when the scrollbar is at its end?
Thanks,
Bill