0

我有来自 Dynamic Drive DHTMl 的滚动脚本,一切正常,但我需要更改滚动条在最后一张图像上停止,但我没有得到任何响应。那里也有另一个滚动条的脚本,如果不把它搞砸的话,我似乎无法删除它。有人可以帮我让它停止并删除第二个滚动条脚本吗?将不胜感激。

<script type="text/javascript">
/*<![CDATA[*/
// Fade Slider (04-August-2013)
// by Vic Phillips http://www.vicsjavascripts.org.uk/


var zxcFadeSlider={

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.c+ud);
}
},

GoTo:function(id,c){
var o=this['zxc'+id];
if (o){
this.Pause(id);
if (o.ary[c]&&c!=o.c){
o.ud=c>o.c?1:-1;
this.rotate(o,c);
}
}
},

Auto:function(id,ms){
var oop=this,o=oop['zxc'+id];
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.ScrollerID,ary=o.ContentArray,m=o.Mode,ms=o.ScrollDuration,ud=o.Direction,hold=o.AutoHold,srt=o.    AutoStart,m=typeof(m)=='string'&&m.charAt(0)=='H'?['left','top','offsetWidth']:['top','left','offsetHeight'],p=document.getElementById(id),s=p?p.getElementsByTagName('DIV')[0]:null,ms=typeof(ms)=='number'&&ms>20?ms:1000;

if (s&&ary instanceof Array){
p.style.overflow='hidden';
this['zxc'+id]=o;
o.m=m;
o.id=id;
o.ary=ary;
o.sz=p[m[2]];
s.style.position='absolute';
s.style.zIndex='0';
s.style[m[1]]='0px';
s.style[m[0]]=o.sz+'px';
s.style.width='100%';
s.style.height=p.offsetHeight+'px';
o.s=s;
o.a=[s.cloneNode(false),m[0]];
o.f=[o.a[0]];
p.appendChild(o.a[0]);
o.a[0].style.zIndex='2';
o.ms=ms;
o.ud=typeof(ud)=='number'&&ud<0?-1:1;
o.c=o.ud==1?-1:ary.length;
o.hold=typeof(hold)=='number'&&hold>20?hold:ms*4;
typeof(srt)=='number'&&srt>=0?this.Auto(id,srt):null;
}
},

rotate:function(o,a){
o.auto=a===true;
o.c=o.auto?o.c+o.ud:a;
o.c=o.ary[o.c]?o.c:o.ud>0?0:o.ary.length-1;
this.opc(o.s,20);
o.a[0].innerHTML=o.ary[o.c];
this.animate(o,o.f,0,100,new Date(),o.ms);
this.animate(o,o.a,o.sz*o.ud,0,new Date(),o.ms);
typeof(o.OnSlide)=='function'?o.OnSlide(o.c):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.max(f<0||t<0?n:0,n);
a[1]?a[0].style[a[1]]=n+'px':oop.opc(a[0],n);
}
if (ms<mS){
a[4]=setTimeout(function(){ oop.animate(o,a,f,t,srt,mS); },10);
}
else {
a[1]?a[0].style[a[1]]=o.sz+'px':oop.opc(a[0],n);
if (a[1]){
this.opc(o.s,100);
o.s.style[o.m[0]]='0px';
o.s.innerHTML=o.a[0].innerHTML;
clearTimeout(o.to);
o.auto?oop.Auto(o.id,o.hold):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;
}

}

zxcFadeSlider.init({
ScrollerID:'tst',    // the unique ID name of the parent DIV.                        (string)
ContentArray:[       // an arrat defining the inner HTML of each slide.              (array)
'<img src="<?php echo $this->getThemePath();?>/img/slide1.jpg">',
'<img src="<?php echo $this->getThemePath();?>/img/slide2.jpg">',
'<img src="<?php echo $this->getThemePath();?>/img/slide3.jpg">',
'<img src="<?php echo $this->getThemePath();?>/img/slide4.jpg">',
'<img src="<?php echo $this->getThemePath();?>/img/slide5.jpg">'
 ],
Mode:'Vertical',     //(optional) the mode of execution., 'Vertical' or 'Horizontal' (string, default = 'Vertical')
 Direction:1,         //(optional) 1 = auto rotate forward, -1 = auto rotate back.    (number, default = 1 = forward)
 ScrollDuration:1000, //(optional) the slide duration in mill seconds.                (number, default = 1000)
 AutoHold:3000,       //(optional) the auto rotate hold duration in mill seconds.     (number, default = ScrollDuration*4)
 AutoStart:3000,      //(optional) the auto rotate start delay in mill seconds.       (number, default = no auto start)
 OnSlide:function(n){ //(optional) the function to call when the the scroller slides. (function, default = no function)
 // n = the slide number
 document.getElementById('ip').value='Slide = '+n;
 }
 });

 zxcFadeSlider.init({
 ScrollerID:'tst1',
 ContentArray:[
 'Visit our partner site <a href="http://freewarejava.com">Freewarejava.com </a>for free Java applets!',
 'Got JavaScript? <a href="http://www.javascriptkit.com">JavaScript Kit</a> is the most comprehensive JavaScript site online.',
 'Link to Dynamic Drive on your site. Please visit our <a href="http://www.dynamicdrive.com/link.htm">links page</a>.'
 ],
 Mode:'Horizontal',
 AutoStart:0
 });

 /*]]>*/
 </script>
4

0 回答 0