所以我正在使用动态轮播的这个例子,我正在尝试配置javascript以允许它滚动一次但是然后重新开始并停在幻灯片#1上:这是网站:http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm
我试图将autostep参数从true更改为false但是要么永远循环要么停在最后一个上。
我试图使用: onslide:函数()
但是我无法弄清楚滑块如何知道最后一张幻灯片是什么的语法。
任何人都可以帮我吗?
答案 0 :(得分:0)
答案发布在这里: http://www.dynamicdrive.com/forums/showthread.php?t=67842
但这是代码:
<script type="text/javascript">
stepcarousel.setup({
galleryid: 'mygallery', //id of carousel DIV
beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
panelclass: 'panel', //class of panel DIVs each holding content
autostep: {enable:true, moveby:1, pause:3000},
panelbehavior: {speed:500, wraparound:false, wrapbehavior:'slide', persist:false},
defaultbuttons: {enable: true, moveby: 1, leftnav: ['10/leftnav.gif', -5, 80], rightnav: ['10/rightnav.gif', -20, 80]},
statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
contenttype: ['inline'], //content setting ['inline'] or ['ajax', 'path_to_external_file']
**onslide: function(){
var id = 'mygallery', car = stepcarousel.configholder[id];
if(car.currentpanel == car.lastvisiblepanel && !car.hasstopped){ //if we're at the end
setTimeout(function(){stepcarousel.stepTo(id, 1);}, car.autostep.pause); //step one more time
car.onslide = function(){}; //and stop checking
}
}**
})
</script>
然后你还必须从:
更改stepcarousel.jsstopautostep:function(config){
clearTimeout(config.steptimer)
},
为:
stopautostep:function(config){
clearTimeout(config.steptimer);
config.hasstopped = true;
},
不能感谢John足以帮助我,希望它可以帮助其他人。