jQuery using .html & then window.scrollTo
- by AnApprentice
Hello, I'm doing the following:
First, inject HTML into the page (a lot) which then increases the window scrollbar:
$("#XXXX").html("LOTS OF HTML").show();
Then i want to scroll down to the end of the page:
window.scrollTo(0,$(document).height());
Problem is the page never scrolls down. I did some console.logging and the scrollTo is running before the HTML from the inject html() is run. I tried this in the JS which injects the HTML, I then tried doing the scroll inside the HTML inject but that made no difference.
Any ideas?