I have been trying to detect when user scrolling hits the bottom
And I have below code.
if ($(window).scrollTop() == ($(document).innerHeight() - $(window).height())){
alert('22')
}
the issue here is, $(window).height() returns the same as $(document).height(), which is bigger than actual window view port.
my screen resultion is about 1280px.
but $(document).height returns 1670 something and so is $(window).height().
so document.height – window.height is always 0
Am I doing something wrong?
Im using Mac OSx Chrome.
Thanks
////////////////////////
window.innerHeight and document.height fixed the issue as Sushil suggested
This should work;