Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
.slideshow {
position:relative;width:200px;height:150px;border:solid red 1px;float:left;
}
/*]]>*/
</style></head>
<body>
<div id="ss1" class="slideshow" >
<img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" alt="img" />
</div>
<div id="ss2" class="slideshow" >
<img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" alt="img" />
</div>
<div id="ss3" class="slideshow" >
<img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt7.jpg" alt="img" />
</div>
<script type="text/javascript">
/*<![CDATA[*/
function zxcLinkedSlideShow(o){
var oop=this,ary=o.SlideShowArray,z0=0,z0a,obj,img,nimg,pl=[],dly=o.InitialDelay;
this.ary=[];
for (;z0<ary.length;z0++){
obj=document.getElementById(ary[z0][0]);
if (obj){
img=obj.getElementsByTagName('IMG')[0];
if (img){
nimg=img.cloneNode(false);
nimg.style.position='absolute';
nimg.style.visibility='hidden';
nimg.style.zIndex='2';
nimg.style.left='0px';
nimg.style.top='0px';
obj.appendChild(nimg);
ary[z0][0]=[nimg,img,3,typeof(ary[z0][1])=='number'?ary[z0][1]:1000,typeof(ary[z0][2])=='number'?ary[z0][2]:1000];
ary[z0].push(img.src);
this.ary.push(ary[z0])
for (z0a=3;z0a<ary[z0].length;z0a++){
img=new Image();
img.src=ary[z0][z0a];
pl.push(img);
}
}
}
}
this.cnt=0;
setTimeout( function(){ oop.next(); },typeof(dly)=='number'?dly:10);
}
zxcLinkedSlideShow.prototype={
next:function(){
var ary=this.ary[this.cnt],cnt=ary[0][2]+1;
cnt=cnt<ary.length?cnt:3;
ary[0][0].src=ary[cnt];
this.animate(ary[0],0,100,new Date(),ary[0][3]);
ary[0][0].style.visibility='visible';
ary[0][2]=cnt;
},
animate:function(ary,f,t,srt,mS){
var oop=this,obj=ary[0],ms=new Date().getTime()-srt,opc=(t-f)/mS*ms+f;
if (isFinite(opc)){
obj.style.filter='alpha(opacity='+opc+')';
obj.style.opacity=obj.style.MozOpacity=obj.style.WebkitOpacity=obj.style.KhtmlOpacity=opc/100-.001;
}
if (ms<mS){
this.dly=setTimeout(function(){ oop.animate(ary,f,t,srt,mS); },10);
}
else {
ary[0].style.visibility='hidden';
ary[1].src=ary[0].src;
this.cnt=++this.cnt%this.ary.length;
this.hold=setTimeout(function(){ oop.next(); },ary[4]);
}
}
}
new zxcLinkedSlideShow({
SlideShowArray:[
[
'ss1', // the unique ID name of the parent node. (string)
1000, // the fade effect duration in milli seconds. (number)
10, // the 'hold' duration in milli seconds. (number)
'http://www.vicsjavascripts.org.uk/StdImages/Egypt8.jpg', // the src of the slide show frame. (string)
'http://www.vicsjavascripts.org.uk/StdImages/Egypt9.jpg',
'http://www.vicsjavascripts.org.uk/StdImages/Egypt11.jpg'
],
[
'ss2',
1000,
10,
'http://www.vicsjavascripts.org.uk/StdImages/Egypt8.jpg',
'http://www.vicsjavascripts.org.uk/StdImages/Egypt9.jpg',
'http://www.vicsjavascripts.org.uk/StdImages/Egypt11.jpg',
'http://www.vicsjavascripts.org.uk/StdImages/Egypt12.jpg'
],
[
'ss3',
1000,
2000,
'http://www.vicsjavascripts.org.uk/StdImages/Egypt13.jpg',
'http://www.vicsjavascripts.org.uk/StdImages/Egypt9.jpg',
'http://www.vicsjavascripts.org.uk/StdImages/Egypt11.jpg'
]
],
InitialDelay:2000 // the initial delay in milli seconds. (number)
});
/*]]>*/
</script>
</body>
</html>
Bookmarks