Skip to content

Conversation

@DaKoala
Copy link

@DaKoala DaKoala commented Apr 21, 2019

In the remark slideshow. If you scroll on your touch pad even a little, the slides will go forward/back multiple slides. I add a function to throttle emitters of scrolling. Therefore, the slides will only change by 1 when a user scrolls.

var timestamp = null;
return function() {
var now = Date.now();
if (timestamp === null || now - timestamp > 100) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about making this optional?

Right now you can enable/disable scrolling - would it make sense to add an option to throttle and the time value e.g.:

var slideshow = remark.create({
  navigation: {
      scrollThrottle: 100,  // default value would be 0 or the same behavior we have today.
  }
});

@denilsonsa
Copy link

denilsonsa commented Jan 17, 2020

Instead of this throttle-based implementation, which essentially slows down all users, regardless of how fast they are actually trying to scroll, how about listening to wheel event, and then having some threshold of how far up or down (or left/right) until the slide changes? But care must be taken not to break mouse scroll (because mouse scroll does not have small steps like a touchpad), probably by also paying attention to deltaMode. Maybe we could also try listening to pointer events.

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

Successfully merging this pull request may close these issues.

3 participants