Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Feature] Infinfite scroll for wheel plugin #1342

Open
dpa99c opened this issue Jun 2, 2023 · 0 comments
Open

[New Feature] Infinfite scroll for wheel plugin #1342

dpa99c opened this issue Jun 2, 2023 · 0 comments

Comments

@dpa99c
Copy link

dpa99c commented Jun 2, 2023

What problem does this feature solve?

The wheel plugin is great for implementing iOS-style pickers.

However, similar to native iOS date/time picker UI, it would be useful to be able to have an option to infinitely scroll the wheel so once the last value in the list is reached, the first value appears again, giving the impression it really is a circular wheel.

In my use case, I am creating a combination lock using the wheel plugin so it makes sense that the rotation would be infinite, like a real physical combination lock, for example:
image

While it's possible to implement a pseudo-infinite wheel by repeating the given values a large number of times as suggested here, this can both potentially affect performance due to the large number of DOM nodes and also as pointed out in the comments, a diligent user may still scroll to the end.

What does the proposed API look like?

I imagine this would just require a boolean infinite flag in the wheel options, e.g.:

const bs = new BScroll('.wrapper', {
  wheel: {
    wheelWrapperClass: 'wheel-scroll',
    wheelItemClass: 'wheel-item',
    rotate: 25,
    adjustTime: 400,
    selectedIndex: 0,
    wheelDisabledItemClass: 'wheel-disabled-item',
    infinite: true
  }
})
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

No branches or pull requests

1 participant