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

Dom scroll parent with unfixed height #51

Closed
dtmzr opened this issue Feb 17, 2017 · 1 comment
Closed

Dom scroll parent with unfixed height #51

dtmzr opened this issue Feb 17, 2017 · 1 comment

Comments

@dtmzr
Copy link

dtmzr commented Feb 17, 2017

Currently working on a project where the wrapper, which can be scrolled, has following styling:

.style {
    height: 100%;
    overflow-y: auto;
}

In this case offset needs to be calculated like this:

offset = el.parentNode.scrollHeight - el.parentNode.scrollTop - el.parentNode.clientHeight;

instead of this:

offset = el.scrollHeight - el.parentNode.scrollTop - el.parentNode.clientHeight;

How about a prop (boolean) relativeParentHeight?

@danbovey
Copy link
Owner

I'll test this out as soon as I can.

Something I've recommended to a lot of people who don't have flexibility with the parentNode of the component is to use react-dimensions. So you could use that on the wrapper to take up the height of the parent container instead of styling it height: 100%.

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

2 participants