PDA

View Full Version : Pausing Featured Content Slider onMouseOver - - Does anyone have a clue?



TCAdmin
10-21-2007, 09:47 PM
1) Script Title:
Featured Content Slider

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamici...tentslider.htm

3) Describe problem:
I was wondering how to pause the slideshow when the mouse is over the actual content, without clicking on the textual link. I Already costumized the script a bit, see http://www.teenagechannel.nl/ for an example.

I posted this before, but nobody replied. Does anyone have a clue how i can fix this, its really important.

ddadmin
10-23-2007, 02:40 AM
Sure. Attached is the default contentslider.js file, modified to include "pause" onmouseover feature. Since you mentioned you had customized the file already yourself, the changes you need to make based on the default file are:

1) Replace the code:


if (typeof autorun=="number" && autorun>0) //if autorun parameter (int_miliseconds) is defined, fire auto run sequence
window[sliderid+"timer"]=setTimeout(function(){ContentSlider.autoturnpage(sliderid, autorun)}, autorun)

with:


if (typeof autorun=="number" && autorun>0){ //if autorun parameter (int_miliseconds) is defined, fire auto run sequence
window[sliderid+"timer"]=setTimeout(function(){ContentSlider.autoturnpage(sliderid, autorun)}, autorun)
document.getElementById(sliderid).mouseisover=0
document.getElementById(sliderid).onmouseover=function(){this.mouseisover=1}
document.getElementById(sliderid).onmouseout=function(){this.mouseisover=0}
}

And replace function ContentSlider.autoturnpage=function(sliderid, autorunperiod) with the below instead:


ContentSlider.autoturnpage=function(sliderid, autorunperiod){
if (document.getElementById(sliderid).mouseisover==0){
var paginatelinks=document.getElementById("paginate-"+sliderid).getElementsByTagName("a") //Get pagination links
var nextpagenumber=parseInt(paginatelinks[paginatelinks.length-1].getAttribute("rel")) //Get page number of next DIV to show
ContentSlider.turnpage(sliderid, nextpagenumber) //Show that DIV
}
window[sliderid+"timer"]=setTimeout(function(){ContentSlider.autoturnpage(sliderid, autorunperiod)}, autorunperiod)
}