Solved

Auto scroll webpage then update page

Posted on 2012-12-22
2
834 Views
Last Modified: 2012-12-23
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
Comment
Question by:zack4x4
2 Comments
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 38716345
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
 
LVL 4

Author Closing Comment

by:zack4x4
ID: 38717640
That worked great thanks!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now