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[*/
#carousel1 {
position:relative;width:815px;height:200px;border:solid red 0px;
}
.belt {
position:absolute;left:0px;top:0px;
}
.belt IMG {
float:left;margin-left:5px; /* do not use margin-right for spacing*/
}
#carousel2 {
position:relative;width:415px;height:200px;border:solid red 1px;
}
#carousel3 {
position:relative;width:200px;height:400px;border:solid red 1px;
}
.beltV IMG {
float:left;margin-top:5px; /* do not use margin-bottom for spacing*/
}
/*]]>*/
</style>
<script type="text/javascript">
/*<![CDATA[*/
// Image Step/Continious Carousel. (19-Febuary-2014)
// by Vic Phillips - http://www.vicsjavascripts.org/
var zxcImageCarousel={
GoTo:function(id,n){
var o=this['zxc'+id];
if (o){
this.Pause(id);
if (n>=0&&n<o.lgth&&n!=o.n){
o.ud=Math.abs(o.ud)*(n>o.n?1:-1);
this.step(o,n);
}
}
},
Auto:function(id,ms){
var oop=this,o=oop['zxc'+id];
o?o.to=setTimeout(function(){ oop.step(o,true); },ms||200):null;
},
Pause:function(id){
var o=this['zxc'+id];
if (o){
clearTimeout(o.to);
o.auto=false;
}
},
init:function(o){
var id=o.CarouselID,m=o.Mode,ld=o.ImagePreload,p=document.getElementById(id),s=p?p.getElementsByTagName('DIV')[0]:null,imgs=s?s.getElementsByTagName('IMG'):[];
if (imgs[1]){
var ary=[],z0=0;
o.m=typeof(m)=='string'&&m.charAt(0).toUpperCase()=='V'?['top','left','height','offsetTop','offsetHeight']:['left','top','width','offsetLeft','offsetWidth']
for (;z0<imgs.length;z0++){
ary[z0]=[imgs[z0],new Image()];
ary[z0][1].src=imgs[z0].src;
}
p.style.overflow='hidden';
s.style[o.m[2]]='30000px';
o.id=id;
o.p=p;
o.s=s;
this.load(o,ary,new Date(),(typeof(ld)=='number'&&ld>0?ld:10)*1000);
}
},
load:function(o,ary,d,ms){
for (var oop=this,z0=0,z1=0;z0<ary.length;z0++){
if (ary[z0][1].width<40&&new Date()-d<ms){
return o.to=setTimeout(function(){ oop.load(o,ary,d,ms); },200);
}
}
for (;z1<ary.length;z1++){
if (ary[z1][1].width<40){
ary[z1][0].parentNode.removeChild(ary[z1][0]);
ary.splice(z1--,1);
}
}
ary[1]?oop.ready(o,ary):null;
},
ready:function(o,ary){
var n=o.StepIndex,ud=o.AutoDirection,add=o.AddEvents,ms=o.StepAnimate,h=o.AutoHold,srt=o.AutoStart,c=o.s.cloneNode(true),add=add instanceof Array?add:[],sz,cc,e,t,z0=0,z1=1,z2=0;
for (;z0<ary.length;z0++){
ary[z0][1]=ary[z0][0][o.m[3]];
}
o.n=ary[n]?n:0;
sz=ary[z0-1][1]+ary[z0-1][0][o.m[4]];
o.s.style.position='absolute';
o.s.style[o.m[2]]=c.style[o.m[2]]=sz+5+'px';
c.style[o.m[1]]='0px';
for (;z1<Math.ceil(o.p[o.m[4]]/sz)+1;z1++){
cc=c.cloneNode(true);
cc.style[o.m[0]]=sz*z1+'px';
o.s.appendChild(cc);
}
ary[z0]=[null,sz+ary[0][1]];
o.step=o.Step!==false;
o.ud=typeof(ud)=='number'&&ud!=0?ud:3;
o.lgth=z0;
o.sz=sz;
o.ms=typeof(ms)=='number'&&ms>100?ms:500;
o.i=Math.PI/(2*o.ms);
o.h=typeof(h)=='number'&&h>0?h:o.ms*4;
o.s=[o.s,o.m[0],-ary[o.n][1]];
o.s[0].style[o.m[0]]=o.s[2]+'px';
o.ary=ary;
for (;z2<add.length;z2++){
if (add[z2]&&add[z2][0]){
e=document.getElementById(add[z2][0]);
t=add[z2][1];
t=(typeof(t)=='string'?t:'').replace('on','');
if (e&&t&&this[add[z2][2]]){
this.addevt(e,t=='click'||t=='mouseover'||t=='mouseout'||t=='mousedown'?t:'mouseup',add[z2][2],o.id,add[z2][3]);
}
}
}
this['zxc'+o.id]=o;
typeof(srt)=='number'&&srt>0?this.Auto(o.id,srt):null;
},
step:function(o,a){
this.Pause(o.id);
o.auto=a===true;
var n=o.n;
n=o.auto?n+(o.ud>0?1:-1):a;
if (o.step&&!o.ary[n]){
n=o.ud>0?1:o.lgth-1;
o.s[2]=-o.ary[o.ud>0?0:o.lgth][1];
}
if (!o.step&&o.auto){
o.s[2]-=o.ud;
o.s[2]<-o.sz?o.s[2]+=o.sz:o.s[2]>0?o.s[2]-=o.sz:null;
o.s[0].style[o.s[1]]=o.s[2]+'px';
o.auto?this.Auto(o.id,30):null;
}
else {
this.animate(o,o.s,o.s[2],-o.ary[n][1],new Date(),o.ms);
o.n=o.step?n:-1;
}
},
animate:function(o,a,f,t,srt,mS){
clearTimeout(a[4]);
var oop=this,ms=new Date()-srt,n=(t-f)*Math.sin(o.i*ms)+f;
if (isFinite(n)){
a[2]=n;
a[0].style[a[1]]=n+'px';
}
if (ms<mS){
a[4]=setTimeout(function(){ oop.animate(o,a,f,t,srt,mS); },10);
}
else {
a[2]=t;
a[0].style[a[1]]=t+'px';
o.auto?oop.Auto(o.id,o.h):null;
}
},
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;
}
}
/*]]>*/
</script>
</head>
<body>
<input type="button" name="" value="Goto 1" onmouseup="zxcImageCarousel.GoTo('carousel1',1);" />
<input type="button" id="b1" value="Goto 4" />
<table border="1" cellpadding="0" cellspacing="0" width="815" height="278">
<tr>
<td height="200">
<div id="carousel1" >
<div class="belt" >
<a href="http://sportsantiques.com/2013NSCC/IndianaAntiqueAlley/pict7482.jpg" target="_blank"><img src="http://sportsantiques.com/2013NSCC/200t/indiana/IAA (1).jpg" border=0></a>
<a href="http://sportsantiques.com/2013NSCC/IndianaAntiqueAlley/pict7483.jpg" target="_blank"><img src="http://sportsantiques.com/2013NSCC/200t/indiana/IAA (2).jpg" border=0></a>
<a href="http://sportsantiques.com/2013NSCC/IndianaAntiqueAlley/pict7484.jpg" target="_blank"><img src="http://sportsantiques.com/2013NSCC/200t/indiana/IAA (3).jpg" border=0></a>
</div>
</div>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" height="78">
</td>
</tr>
</table>
<div id="carousel2" onmouseover="zxcImageCarousel.Pause('carousel2');" onmouseout="zxcImageCarousel.Auto('carousel2');" >
<div class="belt" >
<a href="http://sportsantiques.com/2013NSCC/IndianaAntiqueAlley/pict7492.jpg" target="_blank"><img src="http://sportsantiques.com/2013NSCC/200t/indiana/IAA (1).jpg" border=0></a>
<a href="http://sportsantiques.com/2013NSCC/IndianaAntiqueAlley/pict7493.jpg" target="_blank"><img src="http://sportsantiques.com/2013NSCC/200t/indiana/IAA (2).jpg" border=0></a>
<a href="http://sportsantiques.com/2013NSCC/IndianaAntiqueAlley/pict7494.jpg" target="_blank"><img src="http://sportsantiques.com/2013NSCC/200t/indiana/IAA (3).jpg" border=0></a>
</div>
</div>
<div id="carousel3" onmouseover="zxcImageCarousel.Pause('carousel3');" onmouseout="zxcImageCarousel.Auto('carousel3');" >
<div class="beltV" >
<a href="http://sportsantiques.com/2013NSCC/IndianaAntiqueAlley/pict7492.jpg" target="_blank"><img src="http://sportsantiques.com/2013NSCC/200t/indiana/IAA (1).jpg" border=0></a>
<a href="http://sportsantiques.com/2013NSCC/IndianaAntiqueAlley/pict7493.jpg" target="_blank"><img src="http://sportsantiques.com/2013NSCC/200t/indiana/IAA (2).jpg" border=0></a>
<a href="http://sportsantiques.com/2013NSCC/IndianaAntiqueAlley/pict7494.jpg" target="_blank"><img src="http://sportsantiques.com/2013NSCC/200t/indiana/IAA (3).jpg" border=0></a>
</div>
</div>
<script type="text/javascript">
/*<![CDATA[*/
zxcImageCarousel.init({
CarouselID:'carousel1', // the unique ID name of the parent DIV. (string)
Mode:'Horizontal', //(optional) the display mode, 'Horizontal' or 'Vertical'. (string, default = 'Horizontal')
Step:false, //(optional) false = continious scroll, true = step scroll. (boolean, default = true = step scroll)
ImagePreload:5, //(optional) the time allowed to load all images in seconds. (number, default = 10)
StepAnimate:500, //(optional) the step animation duration in millisec. (number, default = 500)
StepIndex:1, //(optional) the initial step index. (number, default = 0)
AutoDirection:3, //(optional) the initial auto rotation, >0 = anticlock, <0 = clockwise. (number, default = 3 = anticlock)
AutoHold:1000, //(optional) the auto rotation 'hold' delay in millisec. (number, default = StepAnimate*4)
AutoStart:1000, //(optional) the auto rotation 'start' delay in millisec. (number, default = no auto start)
AddEvents:[ //(optional) the event calls to add to elements to control the script. (array, default = inline event calls)
// field 0 = the unique ID name of the element.
// field 1 = the event type.
// field 2 = the script function name.
// field 3 = the control parameter to pass to the function.
['carousel1','mouseover','Pause'],
['carousel1','mouseout','Auto'],
['b1','mouseup','GoTo',4]
]
});
zxcImageCarousel.init({
CarouselID:'carousel2',
AutoStart:1000
});
zxcImageCarousel.init({
CarouselID:'carousel3',
Mode:'Vertical',
Step:false,
AutoStart:200
});
/*]]>*/
</script>
</body>
</html>
Bookmarks