0

I have a html-webhandler which is writing back content asynchronously. While this is happening I want to scroll the page to bottom all the time until the page has been completely loaded.

My first attempt revolved around DOM-events such as DOMNodeInsertedIntoDocument. But I soon realized these events don't fire on the initial page load.

My next attempt was to set a timer to scroll to bottom at every 50 or so ms. This kind of worked but I'd like to find a prettier solution.

So my question: Are there any standardized ways of getting events while a document is being parsed and loaded? I'd like to be able to execute a piece of js every time a new element is being added to the document on initial load.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Andreas Zita
  • 7,232
  • 6
  • 54
  • 115
  • When you load asynchronously there is no an event when you receive the response? for example when you call an ajax request on JQuery the onSuccess event is fired. Maybe at the final of the implementation of that method on every request you can scroll down and get the effect that you want – l2mt Nov 02 '13 at 13:38
  • See http://stackoverflow.com/questions/2920129/can-i-run-javascript-before-the-whole-page-is-loaded – cbr Nov 02 '13 at 13:59
  • could use interval timer to check scrollHeight vs scrollTop and adjust accordingly – charlietfl Nov 02 '13 at 15:51

0 Answers0