Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body>
<table border="1">
<tr>
<td>
<input type="button" name="" value="Next" onmouseup="zxcSFSlideShow.Next('i1',1);">
<input type="button" name="" value="Back" onmouseup="zxcSFSlideShow.Next('i1',-1);"><br>
<input type="button" name="" value="Auto" onmouseup="zxcSFSlideShow.Auto('i1');">
<input type="button" name="" value="Pause" onmouseup="zxcSFSlideShow.Pause('i1');">
</td>
<td>
<a href="" >
<img id="i1" src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" alt="image" border="0" onmouseover="zxcSFSlideShow.Pause('i1');" onmouseout="zxcSFSlideShow.Auto('i1');">
</a>
</td>
<td>
<input type="button" name="" value="GoTo 0" onmouseup="zxcSFSlideShow.GoTo('i2',0);">
<input type="button" name="" value="GoTo 1" onmouseup="zxcSFSlideShow.GoTo('i2',1);"><br>
<input type="button" name="" value="GoTo 2" onmouseup="zxcSFSlideShow.GoTo('i2',2);">
</td>
</tr>
<tr>
<td>
<input type="button" name="" value="Next" onmouseup="zxcSFSlideShow.Next('i2',1);">
<input type="button" name="" value="Back" onmouseup="zxcSFSlideShow.Next('i2',-1);"><br>
<input type="button" name="" value="Auto" onmouseup="zxcSFSlideShow.Auto('i2');">
<input type="button" name="" value="Pause" onmouseup="zxcSFSlideShow.Pause('i2');">
</td>
<td>
<a href="" >
<img id="i2" src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" alt="image" border="0" onmouseover="zxcSFSlideShow.Pause('i2');" onmouseout="zxcSFSlideShow.Auto('i2');">
</a>
</td>
<td>
<input type="button" name="" value="GoTo 0" onmouseup="zxcSFSlideShow.GoTo('i3',0);">
<input type="button" name="" value="GoTo 1" onmouseup="zxcSFSlideShow.GoTo('i3',1);"><br>
<input type="button" name="" value="GoTo 2" onmouseup="zxcSFSlideShow.GoTo('i3',2);">
</td>
</tr>
<tr>
<td>
<input type="button" name="" value="Next" onmouseup="zxcSFSlideShow.Next('i3',1);">
<input type="button" name="" value="Back" onmouseup="zxcSFSlideShow.Next('i3',-1);"><br>
<input type="button" name="" value="Auto" onmouseup="zxcSFSlideShow.Auto('i3');">
<input type="button" name="" value="Pause" onmouseup="zxcSFSlideShow.Pause('i3');">
</td>
<td>
<a href="" >
<img id="i3" src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" alt="image" border="0" onmouseover="zxcSFSlideShow.Pause('i3');" onmouseout="zxcSFSlideShow.Auto('i3');">
</a>
</td>
<td>
<input type="button" name="" value="GoTo 0" onmouseup="zxcSFSlideShow.GoTo('i3',0);">
<input type="button" name="" value="GoTo 1" onmouseup="zxcSFSlideShow.GoTo('i3',1);"><br>
<input type="button" name="" value="GoTo 2" onmouseup="zxcSFSlideShow.GoTo('i3',2);">
</td>
</tr>
</table>
<script type="text/javascript">
<!--
// Simple Slide Show. (06-September-2013)
// by: Vic Phillips - http://www.vicsjavascripts.org.uk/
var zxcSFSlideShow={
Next:function(id,ud){
var o=this['zxc'+id],ud=typeof(ud)=='number'&&ud<0?-1:1;
if (o){
o.ud=ud;
this.rotate(o,o.n+ud);
}
},
GoTo:function(id,n){
var o=this['zxc'+id];
if (o&&o.ary[n]){
this.rotate(o,n);
}
},
Auto:function(id,ms){
var o=this['zxc'+id],oop=this;
if (o){
o.to=setTimeout(function(){ oop.rotate(o,true); },ms||200);
}
},
Pause:function(id,ms){
var o=this['zxc'+id];
if (o){
clearTimeout(o.to);
o.auto=false;
}
},
init:function(o){
var id=o.ImageID,ary=o.ImageArray,m=o.Mode,ud=o.Direction,ms=o.AnimateDuration,hold=o.AutoHold,srt=o.AutoStart,img=document.getElementById(id);
if (img&&ary instanceof Array){
var m=typeof(m)=='string'?m.charAt(0).toUpperCase():'F',m=m=='H'?['left','top','width']:m=='V'?['top','left','height']:[''],a=img.parentNode,ms=typeof(ms)=='number'&&ms>0?ms:1000,c=document.createElement('IMG'),d=document.createElement('DIV'),z0=0;
d.style.position=c.style.position='absolute';
d.style.zIndex='201';
d.style.overflow='hidden';
d.style.left=d.style.top=c.style.left=c.style.top='-3000px'
d.appendChild(c);
document.body.appendChild(m[1]?d:c);
for (;z0<ary.length;z0++){
ary[z0][5]=new Image();
ary[z0][5].src=ary[z0][0];
}
o.id=id;
o.img=img;
o.a=a.nodeName.toUpperCase()=='A'?a:null;
o.ary=ary;
o.m=m;
o.c=[c,m[0]];
o.d=d;
o.ud=typeof(ud)=='number'&&ud<0?-1:1;
o.ms=ms;
o.s=o.OnAnimate;
o.f=o.OnComplete;
o.hold=typeof(hold)=='number'&&hold>0?hold:ms*4;
o.n=0;
this['zxc'+id]=o;
typeof(srt)=='number'&&srt>=0?this.Auto(id,srt):null;
}
},
rotate:function(o,auto){
clearTimeout(o.to);
var n=o.n,p=this.pos(o.img),lgth=o.ary.length-1;
o.auto=auto===true;
n=o.auto?n+o.ud:auto;
n=n>lgth?0:n<0?lgth:n;
if (o.ary[n][5].width>40){
typeof(o.s)=='function'?o.s(n):null;
o.c[0].src=o.ary[n][5].src;
o.d.style.width=o.c[0].style.width=o.img.width+'px';
o.d.style.height=o.c[0].style.height=o.img.height+'px';
if (o.m[0]){
o.c[0].style[o.m[0]]=o.img[o.m[2]]*o.ud+'px';
o.c[0].style[o.m[1]]='0px';
}
this.animate(o,o.c,o.m[0]?o.img[o.m[2]]*o.ud:0,o.m[0]?0:100,new Date(),o.ms);
if (!o.m[0]){
o.c[0].style.left=p[0]+'px';
o.c[0].style.top=p[1]+'px';
}
o.d.style.left=p[0]+'px';
o.d.style.top=p[1]+'px';
o.a?o.a.removeAttribute('href'):null;
o.a&&o.ary[n][1]?o.a.href=o.ary[n][1]:null;
o.img.removeAttribute('title');
o.ary[n][2]?o.img.title=o.ary[n][2]:null;
o.n=n;
}
else {
o.ary.splice(n,1);
o.auto?this.Auto(o.id):null;
}
},
animate:function(o,a,f,t,srt,mS){
clearTimeout(a[4]);
var oop=this,ms=new Date()-srt,n=(t-f)/mS*ms+f;
if (isFinite(n)){
n=Math.floor(n);
a[1]?a[0].style[a[1]]=n+'px':oop.opac(a[0],n);
}
if (ms<mS){
a[4]=setTimeout(function(){ oop.animate(o,a,f,t,srt,mS); },10);
}
else {
o.img.src=a[0].src;
(a[1]?o.d:a[0]).style.top='-3000px';
typeof(o.f)=='function'?o.f(n):null;
o.auto?oop.Auto(o.id,o.hold):null;
}
},
opac:function(o,n){
o.style.filter='alpha(opacity='+n+')';
o.style.opacity=o.style.MozOpacity=o.style.WebkitOpacity=o.style.KhtmlOpacity=n/100-.001;
},
pos:function(o){
var rtn=[0,0];
while(o){
rtn[0]+=o.offsetLeft;
rtn[1]+=o.offsetTop;
o=o.offsetParent;
}
return rtn;
}
}
zxcSFSlideShow.init({
ImageID:'i1', // the unique ID name of the image. (string)
ImageArray:[ // an array of arrays defining the images. (array)
// field 0 = the image scr.
// field 1 = (optional) the image link href.
// field 2 = (optional) the image title.
['http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg','http://www.vicsjavascripts.org.uk/','Egypt 1'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt7.jpg','http://www.vicsjavascripts.org.uk/','Egypt 2'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt8.jpg','http://www.vicsjavascripts.org.uk/','Egypt 3']
],
Mode:'Fade', //(optional) the mode, 'Fade', 'Horizontal' or 'Vertical'. (string, default = 'Fade')
AnimateDuration:500, //(optional) the animation duration in milli sceconds. (number, default = 1000)
Direction:-1, //(optional) the initial auto rotation direction, >0 = forward, < o = back. (number, default = 1 = forward)
AutoHold:2000, //(optional) the auto rotation hold delay in milli sceconds. (number, default = FadeDuration*4)
AutoStart:1000, //(optional) the auto rotation start delay in milli sceconds. (number, default = FadeDuration*4)
OnAnimate:function(n){ //(optional) a function to call when starting fade of new image. (function, default = no function)
// n =the current imasge index.
// zxcSFSlideShow.GoTo('i2',n);
// zxcSFSlideShow.GoTo('i3',n);
},
OnComplete:function(n){ //(optional) a function to call when fade in is complete. (function, default = no function)
// n =the current imasge index.
}
});
zxcSFSlideShow.init({
ImageID:'i2',
ImageArray:[
// field 0 = the image scr.
// field 1 = (optional) the image link href.
// field 2 = (optional) the image title.
['http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg','http://www.vicsjavascripts.org.uk/','Egypt 1'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt7.jpg','http://www.vicsjavascripts.org.uk/','Egypt 2'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt8.jpg','http://www.vicsjavascripts.org.uk/','Egypt 3']
],
Mode:'Horizontal',
AutoStart:1000
});
zxcSFSlideShow.init({
ImageID:'i3',
ImageArray:[
// field 0 = the image scr.
// field 1 = (optional) the image link href.
// field 2 = (optional) the image title.
['http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg','http://www.vicsjavascripts.org.uk/','Egypt 1'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt7.jpg','http://www.vicsjavascripts.org.uk/','Egypt 2'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt8.jpg','http://www.vicsjavascripts.org.uk/','Egypt 3']
],
Mode:'Vertical',
AutoStart:1000
});
//-->
</script>
</body>
</html>
Bookmarks