PDA

View Full Version : fadeshow STOP?



encrypted
12-10-2006, 06:32 PM
1) Script Title: fadeshow

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm



Can I stop fadeshow at anytime? Lets say I have fadeshow in the [ div ] and contents of this [ div ] must be replaced with something else - but before that I need to stop fadeshow. Otherwise I get JS errors.

Thank you.

Twey
12-10-2006, 06:53 PM
http://www.twey.co.uk/files/slide.html

encrypted
12-10-2006, 06:59 PM
it doesn't look like original script at all :) it's too modified...

just need to stop original fadeshow script with javascript, that's all.

Twey
12-10-2006, 07:07 PM
It is highly modified, but definitely for the better. The controls can be hidden with CSS, if you so desire. More importantly, the event on the "Stop" button demonstrates how to halt it with script.

encrypted
12-12-2006, 03:39 PM
yes, twey, I tried your code, it's completely different, of course :) anyway, it doesn't work on my page for some reason (says stopstart() is not a function) and it has much of the functionality I don't need. it does work as standalone though...

is there's a way the original code could be modified to have some function like stop() where slideshow could be stopped? I don't compleletely understand the code, it's too complicated for my JS understanding.

No?

jscheuer1
12-12-2006, 04:10 PM
1) Script Title: fadeshow

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm



Can I stop fadeshow at anytime? Lets say I have fadeshow in the [ div ] and contents of this [ div ] must be replaced with something else - but before that I need to stop fadeshow. Otherwise I get JS errors.

Thank you.

Modify the script here (in function fadeshow()):


if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("if(fadearray){fadearray["+this.slideshowid+"].rotateimage()}", this.delay)

here:


function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
if(fadearray)
setTimeout("if(fadearray){fadearray["+obj.slideshowid+"].rotateimage()}", obj.delay)
}
}

and here (in fadeshow.prototype.rotateimage=function()):


fadeclear[this.slideshowid]=setInterval("if(fadearray){fadepic(fadearray["+this.slideshowid+"])}",50)

Then you can stop all slide shows on a page with this:


fadearray=null;

encrypted
12-12-2006, 08:52 PM
Thank you, jscheuer1, so much!

Everything works.