loryjs / lory

☀ Touch enabled minimalistic slider written in vanilla JavaScript.
http://loryjs.github.io/lory/
MIT License
2.28k stars 243 forks source link

Add possibility of sliding with custom speed #695

Closed nkudr closed 6 years ago

nkudr commented 7 years ago

Add customSpeed argument to methods slideTo(), next(), prev(), and to private method slide().

Setting up a custom sliding speed is useful if you want frames to move with natural speed wnen they are touch-sweeped, but more slowly when sliding is caused by another reason (with next/prev/dots controls or a timeout).

nstanard commented 7 years ago

@nkudr Hey, first.... Thanks for contributing.

I'm just wondering how you feel about the slideSpeed option that already exists? Would it not be better to have an option for slide speed and an option for swipe speed? (If you really want to differentiate between the two speeds.) Thoughts?

nkudr commented 7 years ago

@nstanard I thought about this approach. It may be suitable in some cases. But in my case (which has inspired me to make this pull request) custom speed (more slow) is needed only when next() is invoked by SetInterval when user doesn't interact with the slider. So I've preferred more flexible solution.

meandmax commented 6 years ago

@nkudr Thank you for contributing!

I think we agree that this is special need that should not be implemented in the core of lory.js, therefore I will close this one.

Cheers Max