• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 908
  • Last Modified:

Auto scroll webpage then update page

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

0
zack4x4
Asked:
zack4x4
1 Solution
 
Robert SchuttSoftware EngineerCommented:
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

0
 
zack4x4Author Commented:
That worked great thanks!!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now