PDA

View Full Version : Translucent slide show



SSJ
01-17-2008, 09:54 PM
1) Script Title: Translucent slide show

2) Script URL (on DD): I got it from a site that used the script from DD

3) Describe problem: I followed exactly the same procedure, but I only changed the URL of the images used in the slide show. I am having the translucent effect without the images. I am a complete novice in this domain. Don't know what went wrong. Thank you for helping me.
Here is a copy of the script:


<script type="text/javascript">
/***********************************************
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/


var trans_width='320px' //slideshow width
var trans_height='200px' //slideshow height

var pause=6000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
var degree=15 //animation speed. Greater is faster.

var slideshowcontent=new Array()
//Define slideshow contents: [image URL, OPTIONAL LINK, OPTIONAL LINK TARGET]
//php code satart
//slideshowcontent[0]=["img\ecole\efk.jpg "]
slideshowcontent[0]=["img\ecole\arbre.jpg"]
slideshowcontent[1]=["img\ecole\info.jpg"]
slideshowcontent[2]=["img\ecole\etage1.jpg"]
slideshowcontent[3]=["img\ecole\hall3.jpg"]
slideshowcontent[4]=["img\ecole\mlf.jpg"]
slideshowcontent[5]=["img\ecole\mat3.jpg"]
slideshowcontent[6]=["img\ecole\polyvalente1.jpg"]
slideshowcontent[7]=["img\ecole\securite3.jpg"]
slideshowcontent[0]=["img\ecole\sciences.jpg"]
slideshowcontent[1]=["img\ecole\entree5.jpg"]
slideshowcontent[2]=["img\ecole\hall2.jpg"]
slideshowcontent[3]=["img\ecole\mat1.jpg"]
slideshowcontent[4]=["img\ecole\cantine1.jpg"]
slideshowcontent[5]=["img\ecole\casiers2.jpg"]
slideshowcontent[6]=["img\ecole\c.jpg"]
slideshowcontent[7]=["img\ecole\arbre2.jpg"]
//php code satart
////NO need to edit beyond here/////////////
var bgcolor='#fxc62d'
var imageholder=new Array()
for (i=0;i<slideshowcontent.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideshowcontent[i][0]
}
var ie4=document.all
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1
if (ie4||dom)
document.write('<div style="position:relative;width:'+trans_width+';height:'+trans_height+';overflow:hidden"><div id="canvas0" style="position:absolute;background-color:'+bgcolor+';width:'+trans_width+';height:'+trans_height+';top:'+trans_height +';left:0;filter:alpha(opacity=20);-moz-opacity:0.2;"></div><div id="canvas1" style="position:absolute;background-color:'+bgcolor+';width:'+trans_width+';height:'+trans_height+';top:'+trans_height +';left:0;filter:alpha(opacity=20);-moz-opacity:0.2;"></div></div>')
else if (document.layers){
document.write('<ilayer id=tickernsmain visibility=hide width='+trans_width+' height='+trans_height+' bgColor='+bgcolor+'><layer id=tickernssub width='+trans_width+' height='+trans_height+' left=0 top=0>'+'<img src="'+slideshowcontent[0][0]+'"></layer></ilayer>')
}
var curpos=trans_width*(-1)
var curcanvas="canvas0"
var curindex=0
var nextindex=1
function getslidehtml(theslide){
var slidehtml=""
if (theslide[1]!="")
slidehtml='<a href="'+theslide[1]+'" target="'+theslide[2]+'">'
slidehtml+='<img src="'+theslide[0]+'" border=1 width=597 height=237 style="border-color:#8D3B16; ">'
if (theslide[1]!="")
slidehtml+='</a>'
return slidehtml
}

function moveslide(){
if (curpos<0){
curpos=Math.min(curpos+degree,0)
tempobj.style.top=curpos+"px"
}
else{
clearInterval(dropslide)
if (crossobj.filters)
crossobj.filters.alpha.opacity=100
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=1
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML=getslidehtml(slideshowcontent[curindex])
nextindex=(nextindex<slideshowcontent.length-1)? nextindex+1 : 0
setTimeout("rotateslide()",pause)
}
}

function rotateslide(){
if (ie4||dom){
resetit(curcanvas)
crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
if (crossobj.filters)
document.all.canvas0.filters.alpha.opacity=document.all.canvas1.filters.alpha.opacity=20
else if (crossobj.style.MozOpacity)
document.getElementById("canvas0").style.MozOpacity=document.getElementById("canvas1").style.MozOpacity=0.2
var temp='setInterval("moveslide()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else if (document.layers){
crossobj.document.write(getslidehtml(slideshowcontent[curindex]))
crossobj.document.close()
}
//curindex=(curindex<slideshowcontent.length-1)? curindex+1 : 0
var maxValue=slideshowcontent.length-1;
curindex=Math.round(maxValue*Math.random());
}

function jumptoslide(which){
curindex=which
rotateslide()
}

function resetit(what){
curpos=parseInt(trans_width)*(-1)
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
crossobj.style.top=curpos+"px"
}

function startit(){
crossobj=ie4? eval("document.all."+curcanvas) : dom? document.getElementById(curcanvas) : document.tickernsmain.document.tickernssub
if (ie4||dom){
crossobj.innerHTML=getslidehtml(slideshowcontent[curindex])
rotateslide()
}
else{
document.tickernsmain.visibility='show'
curindex++
setInterval("rotateslide()",pause)
}
}

if (window.addEventListener)
window.addEventListener("load", startit, false)
else if (window.attachEvent)
window.attachEvent("onload", startit)
else if (ie4||dom||document.layers)
window.onload=startit
</script>

jscheuer1
01-18-2008, 04:51 AM
This and similar:


slideshowcontent[0]=["img\ecole\arbre.jpg"]

need to use the / slash:


slideshowcontent[0]=["img/ecole/arbre.jpg"]

There could also be other problems.

I think the script you are using has its demo page here:

http://www.dynamicdrive.com/dynamicindex14/translucentslide.htm

If that's the one, it would be best to use a fresh copy from the demo page and to follow the instructions there, as well as to read the the other information available on that page about the script.