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[*/
#parent {
position:absolute;left:100px;top:100px;width:350px;height:263px;border:solid red 1px;
}
#parent .slide {
width:350px;height:263px;border-Width:0px;
}
/* Pagination */
#pagination {
position:absolute;z-Index:10;left:0px;top:240px;width:350px;
}
#pagination .page {
position:relative;left:140px;top:4px;width:16px;height:16px;float:left;margin-Right:5px;background-Color:red;text-Align:center;font-Size:12px;cursor:pointer;
}
#pagination .current {
background-Color:green;
}
/*]]>*/
</style></head>
<body>
<input type="button" name="" value="Next" onclick="zxcSlideSlideShow.Next('parent',1);"/>
<input type="button" name="" value="Back" onclick="zxcSlideSlideShow.Next('parent',11);"/>
<input type="button" name="" value="Auto" onclick="zxcSlideSlideShow.Auto('parent');"/>
<input type="button" name="" value="Pause" onclick="zxcSlideSlideShow.Pause('parent');"/>
<input type="button" name="" value="GoTo 0" onclick="zxcSlideSlideShow.GoTo('parent',0);"/>
<input type="button" name="" value="GoTo 1" onclick="zxcSlideSlideShow.GoTo('parent',1);"/>
<input type="button" name="" value="GoTo 2" onclick="zxcSlideSlideShow.GoTo('parent',2);"/>
<div id="parent" >
<div id="pagination" >
<div class="page" ></div>
</div>
</div>
<script type="text/javascript">
/*<![CDATA[*/
// Slide Slide Show. (01-April-2014)
// by Vic Phillips - http://www.vicsjavascripts.org/
var zxcSlideSlideShow={
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,false);
}
},
GoTo:function(id,n){
var o=this['zxc'+id];
if (o&&o.a[n]&&n!=o.n){
o.ud=n>o.n?1:-1;
this.rotate(o,n,false);
}
},
Auto:function(id,ms){
var o=this['zxc'+id],oop=this;
if (o){
o.to=setTimeout(function(){ oop.rotate(o,o.n,true); },ms||200);
}
},
Pause:function(id){
var o=this['zxc'+id],z2=0;
if (o){
clearTimeout(o.to);
o.auto=false;
}
},
init:function(o){
var id=o.ParentID,ia=o.ImageArray,m=o.Mode,add=o.AddEvents,f=o.FadeIn,days=o.Persistence,ms=o.Animation,h=o.AutoHold,s=o.AutoStart,p=document.getElementById(id),ss=p?this.bycls('slide',p):[],pag=document.getElementById(o.PaginateID),ps=pag?this.bycls('page',pag):null,a,i,z0=0;
if (p&&ia instanceof Array){
for (;z0<ia.length;z0++){
if (ia[z0]&&ia[z0][0]){
a=document.createElement('A');
i=document.createElement('IMG');
i.src=ia[z0][0];
i.className='slide';
ia[z0][1]?a.href=ia[z0][1]:null;
ia[z0][2]?a.target=ia[z0][2]:null;
a.appendChild(i);
p.appendChild(a);
}
}
o.ImageArray=null;
this.init(o);
}
else if (ss[0]){
var m=typeof(m)=='string'?m.charAt(0).toUpperCase():'H',days=(typeof(days)=='number'&&days>0)||days=='session'?days:-1,n=days!=-1?this.cookie(id)*1:0,w=p.offsetWidth,h=p.offsetHeight,pge=ps[0]?ps[0]:document.createElement('DIV'),add=typeof(add)=='object'&&add.constructor==Array?add:[],t,z0=0,z1=0,z2=0;
var m=m=='V'?['top','left',h]:['left','top',w]
p.style.overflow='hidden';
o.a=[];
pge.className='page';
for (;z0<ss.length;z0++){
ss[z0].style.position='absolute';
ss[z0].style.zIndex='0';
ss[z0].style[m[0]]='0px';
ss[z0].style[m[1]]=(z0!=n?-3000:0)+'px';
ss[z0].style.width=w+'px';
ss[z0].style.height=h+'px';
pge=ps[z0]?ps[z0]:pge.cloneNode(false);
if (pag&&!ps[z0]){
pag.appendChild(pge);
}
o.a[z0]=[ss[z0],m[0],pge,pge.className];
}
for (;z1<ss.length;z1++){
this.addevt(o.a[z1][2],'mouseup','GoTo',id,z1);
}
for (;z2<add.length;z2++){
if (add[z2]&&this[add[z2][2]]&&document.getElementById(add[z2][0])){
t=add[z2][1];
this.addevt(document.getElementById(add[z2][0]),t=='mouseover'||t=='mouseout'||t=='click'?t:'mouseup',add[z2][2],id,add[z2][3]);
}
}
o.a[n][2].className=o.a[n][3]+' current';
o.id=id;
o.m=m;
o.so=o.SlideOut!==false;
o.n=n;
o.lgth=z0-1;
o.sz=m[2];
o.ud=1;
o.days=days;
o.ms=typeof(ms)=='number'&&ms>20?ms:1000;
o.h=typeof(h)=='number'&&h>20?ms:ms*4;
o.f=typeof(f)=='number'&&f>0?f:null;
this['zxc'+id]=o;
typeof(s)=='number'&&s>0?this.Auto(id,s):null;
}
},
rotate:function (o,n,a){
this.Pause(o.id);
o.auto=a===true;
o.auto?n=n+o.ud:null;
n=n>o.lgth?0:n<0?o.lgth:n;
o.a[o.n][0].style.zIndex='0';
o.a[n][0].style.zIndex='1';
o.a[o.n][2].className=o.a[o.n][3];
o.a[n][2].className=o.a[n][3]+' current';
o.f?this.opc(o.a[n][0],o.f):null;
o.so?this.animate(o,o.a[o.n],0,o.sz*o.ud,new Date(),o.ms,o.n):null;
this.animate(o,o.a[n],o.sz*-o.ud,0,new Date(),o.ms,o.n);
o.a[n][0].style[o.m[1]]='0px';
document.cookie=o.id+'='+n+(typeof(o.days)=='number'?';expires='+(new Date(new Date().getTime()+o.days*86400000).toGMTString())+';path=/;':';');
o.n=n;
},
animate:function(o,a,f,t,srt,mS,m){
clearTimeout(a[5]);
var oop=this,ms=new Date()-srt,n=(t-f)/mS*ms+f;
if (isFinite(n)){
a[0].style[a[1]]=n+'px';
}
if (ms<mS){
a[5]=setTimeout(function(){ oop.animate(o,a,f,t,srt,mS,m); },10);
}
else {
a[0].style[a[1]]=t+'px';
t==0?o.a[m][0].style[o.m[1]]='-3000px':null;
o.f?this.opc(a[0],100):null;
o.auto?oop.Auto(o.id,o.h):null;
}
},
opc:function(o,n){
o.style.filter='alpha(opacity='+n+')';
o.style.opacity=o.style.MozOpacity=o.style.WebkitOpacity=o.style.KhtmlOpacity=n/100-.001;
},
cookie:function(nme){
var re=new RegExp(nme+'=[^;]+','i');
return document.cookie.match(re)?document.cookie.match(re)[0].split("=")[1]:0;
},
addevt:function(o,t,f,p,p1){
var oop=this;
o.addEventListener?o.addEventListener(t,function(e){ return oop[f](p,p1);},false):o.attachEvent?o.attachEvent('on'+t,function(e){ return oop[f](p,p1); }):null;
},
bycls:function (n,o,t){
for (var o=o||document.body,c=o.getElementsByTagName(t||'*'),a=[],z0=0; z0<c.length;z0++){
if((' '+c[z0].className+' ').match(' '+n+' ')){
a.push(c[z0]);
}
}
return a;
}
}
// N.B. all sides must have a class name including the keyword 'slide'.
zxcSlideSlideShow.init({
ParentID:'parent', // the unique ID name of the parent DIV. (string)
Mode:'Horizontal', //(optional) the mode of execution, 'Horizontal' or 'Vertical'. (string, default = 'Horizontal')
SlideOut:false, //(optional) false = slideout is disabled . (boolean, default = true = slideout is enabled)
ImageArray:[ //(optional) the animation duration in milli seconds. (array, default = inline HTML elements)
// field 0 = the image SRC.
// field 1 = (optional) the image link HREF.
// field 2 = (optional) the image link HREF target.
['http://www.vicsjavascripts.org/StdImages/1.gif','http://www.vicsjavascripts.org/','_Blank'],
['http://www.vicsjavascripts.org/StdImages/2.gif','http://www.vicsjavascripts.org/','_Blank'],
['http://www.vicsjavascripts.org/StdImages/3.gif','http://www.vicsjavascripts.org/','_Blank'],
],
Animation:1000, //(optional) the animation duration in milli seconds. (number, default = 1000)
AutoHold:3000, //(optional) the auto rotation hold delay in milli seconds. (number, default = Animation*4)
AutoStart:1000, //(optional) the delay before starting auto rotation in milli seconds. (number, default = no auto start)
FadeIn:70, //(optional) the fade in opacity(0 to 100). (number, default = no fade in)
PaginateID:'pagination', //(optional) the unique ID name of the pagination parent DIV. (string, default = no pagination)
AddEvents:[ //(optional) an array of arrays defining the event calls to add. (array, default = inline event calls)
// field 0 = the unique ID name of the object to add the call to.
// field 1 = the event type, 'mouseover', mouseout, mouseup', mousedown' or 'click'.
// field 2 = the script function to call.
// field 3 = the parameter to pass to the script function.
['parent','mouseover','Pause'],
['parent','mouseout','Auto']
],
Persistence:1 //(optional) the number of days to restore the last display. (number, default = -1)
//(optional) 'session' = restore the last display for the browser session. (number, default = -1 days)
});
/*]]>*/
</script>
</body>
</html>
Bookmarks