JoshDSommer / nativescript-ngx-slides

A NativeScript + Angular module for to add a slides component to your mobile app
Other
45 stars 34 forks source link

Slider Autostart #42

Closed nikksan closed 6 years ago

nikksan commented 6 years ago

Hello, great plugin first! Is there any way the slider can start automatically?

JoshDSommer commented 6 years ago

Thanks, @nikksan!

You could use a setInterval got to slide to automatically change slides. Is that what your looking to do. go t a slide after a few seconds or so?

nikksan commented 6 years ago

Yeah, that will do it. How do I programmatically change the slides?

JoshDSommer commented 6 years ago

The Slides Component has a public function on it to to go to GoToSlide( goes to slide with index param) and next and previouse slides. https://github.com/TheOriginalJosh/nativescript-ngx-slides/blob/master/slides/app/slides/slides.component.ts#L541

nikksan commented 6 years ago

Works like charm.I actually ended up using the method - nextSlide, as it didnt require me to keep the index of the current slide.

nikksan commented 6 years ago

Is there any event triggered when the user swipes the slider? My approach is to postpone the the interval, once the user has interacted with the slider. Any help on that?

JoshDSommer commented 6 years ago

Yep there is a change event https://github.com/TheOriginalJosh/nativescript-ngx-slides/blob/master/slides/app/slides/slides.component.ts#L63 that sounds like what you need

nikksan commented 6 years ago

However this change event is fired when I call nextSlide method, is there any way I can detect when user swipes the slide, and not when I programmatically change it?

JoshDSommer commented 6 years ago

Hi @nikksan, no there is currently no way to differentiate between those. If you want you could change the code so it returns an object that has the index and the referring action. If you do please make a PR.