tiny-slider icon indicating copy to clipboard operation
tiny-slider copied to clipboard

How to intercept item with index 0 (zero)

Open smurfxx opened this issue 5 months ago • 0 comments

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

smurfxx avatar Mar 12 '24 09:03 smurfxx