JavaScripts :: Menus and Movers :: Auto scroller
This free javascript will simply scroll the page vertically for the user. Ideal for smaller pop up windows that display a product and it's description. Create a page with some content, copy and paste the script to the top of the page, then load the page in a small window. Click here for demo (will pop open a new window)
You can set the speed of the scroll by editing the sSpeed variable. The higher the number, the faster the scroll.
To set a delay, which allows time for images to load, set the sDelay variable to the number of seconds the window should wait before starting to scroll.
To add a "back to top" link, the sPos variable must be reset to 0. Use this code to add the link which calls the reset function named toTop
<a href="javascript:toTop()">Top</a>
This is the script that creates the new options
<script>
<!--
// Page scroller. Written by PerlscriptsJavascripts.com
sStart = 0
sTimer = 0;
sPos = 0;
sSpeed = 1;
sDelay = 5;
function toTop() {
sPos = 0;
scrollTo(0,0);
}
function sDown() {
sPos += sSpeed;
window.scroll(0,sPos);
sTimer = setTimeout("sDown()",10);
}
sStart = setTimeout("sDown()",sDelay * 1000);
// -->
</script>
Place this script near the top of your document
|