For a recent project, we are using Cycle2. I've upgraded to the latest version. We are using Sitecore to render content. No matter the approach I take (below), I cannot get autostop to function. We have 2-3 slides per slideshow, and we want it to move in the following pattern: 1-2-3-1.
Whether we render it to autoplay in rules like this:
<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>
Or if we have it play programmatically in JS without the "cycle-slideshow" class:
$('#my-slideshow').cycle({
speed: 3000,
autostop: true,
timeout: 5000,
end: function() {
$('#my-slideshow').cycle('stop');
}
});
Any help / suggestions are appreciated. Thanks for your time.
Assuming you are using the Cycle2 plugin by Malsup, then the documentation for the API does not contain an option called autostop
. Perhaps you mean the loop
option?
loop
integer
0
The number of times an auto-advancing slideshow should loop before terminating. If the value is less than 1 then the slideshow will loop continuously. Set to 1 to loop once, etc.
So either:
<ul ... data-cycle-loop="1" .. /></ul>
or
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);
});