PDA

View Full Version : Pausing up-down Scroller



rswyatt
03-31-2006, 09:14 PM
I have what should hopefully be a relatively simple question about this script.
(relatively simple - however I have no idea how to accomplish it :D )

What I am trying to accomplish is while an item is scrolling I would like it to pause if I then move my mouse over it (while scrolling)... I know mousing over when paused in position will stop it from going on to the next item, however, if I have a relatively long item that is scrolling by - I'd like to mouseover and pause where it is.

How can this be accomplished?

Thanks,
Rich S Wyatt

ddadmin
04-01-2006, 12:51 AM
Warning: Please include a link to the DD script in question in your post, in this case: http://www.dynamicdrive.com/dynamicindex2/crosstick.htm. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

Sure, simply replace the original animateup() function with the below version instead:


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.animateup()}, 100)
else{
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}
}

rswyatt
04-03-2006, 12:44 PM
Fantastic! Thanks! Sorry for not including the link. That'll teach me!