2👍
✅
This happens because you are using windowScrollTop >= (documentHeight - windowHeight - 50
which means windowScrollTop
has 50 chances of being greater or equal to last 50 px of the page height.
So it better you check for another condition also
var scrollUpdateFired = false;
if ( windowScrollTop >= (documentHeight - windowHeight - 50) && !scrollUpdateFired)
{
scrollUpdateFired = true;
this.updateJobs();
}
then in your ajax’s promise sucess callback set the value of scrollUpdateFired
to false
Source:stackexchange.com