Solved

Auto scroll webpage then update page

Posted on 2012-12-22
2
826 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

759 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

21 Experts available now in Live!

Get 1:1 Help Now