How to intercept item with index 0 (zero)
Opened this issue · 0 comments
smurfxx commented
Issue description:
I have an autoplay tiny slide with a timeout of 10 seconds but I'd like to set a timeout of 20 seconds only for the first slide, in other words the slide with index 0.
I tried with the 'indexChanged' event but since it is the first slide, the event only occurs from the second slide onwards. I also tried with the 'onInit' property but the latter only occurs at the beginning of the slide and not after a loop.
So what is the ideal method to intercept the first slide on start and on every loop?
This is an example of my code:
var slider = tns({
container: '.view-slidefarmacia .view-content',
items: 1,
slideBy: 1,
loop: true,
autoplay: true,
autoplayTimeout: 10000,
speed: 400,
gutter: 0,
mouseDrag: false,
touch: true,
nav: false,
freezable: false,
controls: false,
animateIn: "fadeIn",
animateOut: "fadeOut",
mode: "gallery"
});
slider.events.on('indexChanged', function(info, eventName) {
console.log(info.index); // --> this never returns me the index 0
});
Tiny-slider version: 2.9.4