GeoloeG / iron-swipeable-pages

[Polymer 1.x] Element that enables switching between different pages by swiping gesture.
MIT License
49 stars 25 forks source link

FEATURE REQUEST: Add automatic swipes (carousel) ? #46

Open oneezy opened 8 years ago

oneezy commented 8 years ago

FEATURE REQUEST: Add automatic swipes (carousel) ?

n1ywb commented 7 years ago

do you mean have a timer that fires swipes periodically? the element already inherits selectNext() and selectPrevious() from IronSelectableBehavior so you can just call those from a timer function. One caveat is it will animate the wrap-around transition the wrong way, it will animate all the pages sliding back to the first page like a stack instead of sliding directly to the first page like a proper carousel. I hacked in a kludge to make it animate properly on a 3 element list but you'll need to improve it to make it work with more than 3 elements https://github.com/n1ywb/iron-swipeable-pages/commit/cef18dad5c5ed91340edca0d905659cdf2a2f049

oneezy commented 7 years ago

yeah, ideally we could expose the functionality through the API. Something like this,

<iron-swipeable-pages
    timer="3s"
    loop="true"
</iron-swipeable-pages>