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

An error in [isAtBottom] #56

Open
wztscau opened this issue Dec 14, 2018 · 3 comments
Open

An error in [isAtBottom] #56

wztscau opened this issue Dec 14, 2018 · 3 comments

Comments

@wztscau
Copy link

wztscau commented Dec 14, 2018

var isAtBottom = (startY >= curY && el.scrollHeight - el.scrollTop === height);
In this code, in some case, el.scrollHeight - el.scrollTop !== height, such as 900 - 450 !== 449.
So the height should be var height = Math.round(parseFloat(style.getPropertyValue('height')));

@lazd
Copy link
Owner

lazd commented Dec 14, 2018

Please provide sample code, indicate browser and OS, etc.

@julianpoy
Copy link

julianpoy commented Dec 23, 2018

@wztscau Although your solution didn't fix this for me, it lead me down the path to figuring this issue out. For any others who stumble down this path, I solved it by changing this check:

var isAtBottom = (startY >= curY && el.scrollHeight - el.scrollTop === height);

to this:

var isAtBottom = (startY >= curY && el.scrollHeight - el.scrollTop <= height);

The problem seems to be related to the fact that scrollHeight - scrollTop does not always equal height when scrolled to the bottom. It's often a pixel off.

@lazd
Copy link
Owner

lazd commented May 28, 2019

Interesting, I'd accept a PR for this. Thanks!

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

3 participants