I have a scroll event that contains this code. Essentially when I'm reaching near the end of the document, it updatesJobs() via ajax.
if ( windowScrollTop >= (documentHeight - windowHeight - 50) )
{
this.updateJobs();
}
Now this works and the jobs update and display. The problem is, that it won't stop. I.e. for some reason, It keeps updating until it draws out all pages of data.
I assumed that it would stop after the first update and render as the "if" statement would then be false. However, the scroll event triggers without the various positions and heights being updated to reflect the new position (not at the end of document) with the new data.
Should I just add a setTimeout to give it time to render? Is there a better solution?
Thanks!
Aucun commentaire:
Enregistrer un commentaire