Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to intercept item with index 0 (zero) #842

Open
smurfxx opened this issue Mar 12, 2024 · 0 comments
Open

How to intercept item with index 0 (zero) #842

smurfxx opened this issue Mar 12, 2024 · 0 comments

Comments

@smurfxx
Copy link

smurfxx commented Mar 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant