对于最近的项目,我们正在使用Cycle2。我已升级到最新版本。我们正在使用Sitecore呈现内容。无论我采用哪种方法(如下),我都无法自动停止运行。每个幻灯片我们有2-3张幻灯片,我们希望它以以下模式移动:1-2-3-1。
是否按照以下规则将其渲染为自动播放:
<ul class="<%# Sitecore.Context.PageMode.IsPageEditor ? String.Empty : "cycle-slideshow" %> interior"
data-cycle-speed="3000"
data-cycle-autostop="true"
data-cycle-timeout="5000"
data-cycle-auto-height="container"
data-cycle-slides="> li" >
<sc:Placeholder runat="server" ID="SlidePlaceholder" Key="SlidePlaceholder" /></ul>
或者,如果我们让它在JS中以编程方式播放而没有“ cycle-slideshow”类:
$('#my-slideshow').cycle({
speed: 3000,
autostop: true,
timeout: 5000,
end: function() {
$('#my-slideshow').cycle('stop');
}
});
任何帮助/建议表示赞赏。谢谢你的时间。
假设您使用的是Malsup的Cycle2插件,则API的文档中不包含名为的选项autostop
。也许您是说这个loop
选择?
循环
整数
0
自动前进幻灯片放映在终止之前应循环播放的次数。如果该值小于1,则幻灯片将连续循环播放。设置为1循环一次,依此类推。
所以:
<ul ... data-cycle-loop="1" .. /></ul>
要么
var $slideshow = $('#my-slideshow');
$slideshow.cycle({
speed: 3000,
loop: 1,
timeout: 5000
});
// jump back to the first slide when loop has finished
// you might have to use setTimeout() to delay the transition back to the first slide
$slideshow.on('cycle-finished', function(event, opts) {
$slideshow.cycle('goto', 0);
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句