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

Rounding error fix when scrollbar is all the way down or right #486

Merged
merged 2 commits into from
Apr 14, 2016

Conversation

tkhyn
Copy link
Contributor

@tkhyn tkhyn commented Apr 14, 2016

Hi there and thanks for perfect-scrollbar.

I noticed a bug when the scrollbar is in the far bottom / right position. Basically each time I scrolled further (with the bar or with the mouse wheel) it would move one more pixel. I found this problem was mentioned in issue #13, but it did not happen all the time, so I suspected rounding errors and found it was likely (see here).

A simple way to mitigate this (as most browsers don't support sub-pixel scroll values) is to test if the delta between the wanted scroll value and the current one is 1 or lower, and consider there should be no change when it's the case. Hence this PR.

@DanielApt
Copy link
Contributor

Looks great, thank you!

@DanielApt DanielApt closed this Apr 14, 2016
@DanielApt DanielApt reopened this Apr 14, 2016
@DanielApt DanielApt merged commit 269a1dc into mdbootstrap:master Apr 14, 2016
tkhyn added a commit to tkhyn/perfect-scrollbar that referenced this pull request Aug 23, 2017
See PR mdbootstrap#486. Using 2px of rounding error (= 2 rounding errors) instead of 1px
ahkui pushed a commit to ahkui/perfect-scrollbar that referenced this pull request Jun 5, 2018
See PR mdbootstrap#486. Using 2px of rounding error (= 2 rounding errors) instead of 1px
@mdbootstrap mdbootstrap locked and limited conversation to collaborators Mar 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants