voronianski / swipe-js-iso

Universal (a.k.a isomorphic) version of Swipe.js
https://www.npmjs.com/package/swipe-js-iso
MIT License
187 stars 57 forks source link

Allow slideSpeed to be 0 and allow slideSpeed to be set in prev()/next() calls #31

Open spiffre opened 5 years ago

spiffre commented 5 years ago

The slideSpeed || speed check prevented the slide speed to be set to 0 when calling slide().

Similarly, the options.speed || 300 assignment prevented options.speed to be 0 in the initializer (which, granted, may not make for the most useful slider, but still).

Checking against undefined ensures 0 isn't confused with an unset speed value and allows for a truly immediate transition whenever needed.

I've also added an optional speed parameter to prev() and next() -- which is forwarded to the internal call to slide().

Let me know what you think!

spiffre commented 5 years ago

Thanks for the feedback!

I've pushed the requested changes.