Auto scroll webpage then update page

zack4x4
zack4x4 used Ask the Experts™
on
hi - I'm using the following code below.  After the page is done scrolling I need to change to a different page.  I'm not sure how to determine when the page has finished scrolling.  I can use something different if needed.

Thanks!!

 
<script type="text/javascript">

function pageScrollPause() {
  window.setTimeout(pageScroll,6000)
}

function pageScroll() {
    document..scrollBy(0,1);
    scrolldelay = setTimeout('pageScroll()',10);
}
</script>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Engineer
Commented:
try this:
var savpos = -1;
function pageScroll() {
    scrollBy(0,1);
		if (savpos == document.body.scrollTop) { // didn't scroll - end reached

			// TODO: redirect
			// window.location.href = '...';

			// to test, show alert
			// alert('done');

		} else {
			savpos = document.body.scrollTop;
			scrolldelay = setTimeout(pageScroll,10);
		}
}

Open in new window

Author

Commented:
That worked great thanks!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial