View Full Version : Top-Down scrolling window - pause on mouseover?
Andrew
06-02-2006, 04:49 PM
Script: Top-Down scrolling window
http://www.dynamicdrive.com/dynamicindex8/topscroll.htm
Is there any way to make the scrolling page pause on mouseover (and resume on mouseout) when using the above script?
jscheuer1
06-03-2006, 07:57 AM
<script type="text/javascript">
/*
Top-Down scrolling window Script- © Dynamic Drive (www.dynamicdrive.com)
For full source code, visit http://www.dynamicdrive.com
This notice MUST stay intact for use
*/
//change 1 to another integer to alter the scroll speed. Greater is faster
var speed=1, theInterval, going=0;
var currentpos=0,alt=1,curpos1=0,curpos2=-1
function initialize(){
startit()
}
function iecompattest(){
return (document.compatMode!="BackCompat")? document.documentElement : document.body
}
function scrollwindow(){
if (document.all)
temp=iecompattest().scrollTop
else
temp=window.pageYOffset
if (alt==0)
alt=1
else
alt=0
if (alt==0)
curpos1=temp
else
curpos2=temp
if (curpos1!=curpos2){
if (document.all)
currentpos=iecompattest().scrollTop+speed
else
currentpos=window.pageYOffset+speed
window.scroll(0,currentpos)
}
else{
currentpos=0
window.scroll(0,currentpos)
}
}
function startit(){
if(!going){
theInterval=setInterval("scrollwindow()",10)
going=1
}
}
function stopit(){
clearInterval(theInterval)
going=0
}
window.onload=initialize
document.onmouseover=stopit;
document.onmouseout=startit;
</script>
Andrew
06-03-2006, 09:28 AM
Ah, excellent, thanks a lot John! ;)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.