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

Give the .fakeScroll__track div a class when there is nothing to scroll #17

Closed
ataylor32 opened this issue Sep 23, 2020 · 7 comments
Closed

Comments

@ataylor32
Copy link

When no scrolling is necessary, the .fakeScroll__bar div is hidden with display: none. This is good, but I think it would also be good if the .fakeScroll__track div was given a class like .fakeScroll__has_hidden_bar or something along those lines so that developers could more easily update the styling of the track when there is nothing to scroll.

@yairEO
Copy link
Owner

yairEO commented Sep 25, 2020

Good idea, thanks!

@ataylor32
Copy link
Author

Do you know when this might be added? Is there anything I can do to help?

@yairEO
Copy link
Owner

yairEO commented Sep 28, 2020

Hi I am spending all day to port my code to React and once it's done I'll release it along with the change you've requested (hopefully today but I'm currently facing one last tough bug with the React port)

@yairEO
Copy link
Owner

yairEO commented Sep 28, 2020

Done. update to v2.2.0, see docs for DOM structure.

@yairEO yairEO closed this as completed Sep 28, 2020
@ataylor32
Copy link
Author

Thanks! In order to get this working properly on my project, I had to remove the following from onScrollResize:

this.DOM.scope.classList.toggle('fakeScroll--hasBar', this.state.scrollRatio < 1)

I then added the following to moveBar at the same point where this.DOM.bar.style.cssText gets set:

if (scrollHeight <= ownHeight) {
    this.DOM.scope.classList.remove('fakeScroll--hasBar');
}
else {
    this.DOM.scope.classList.add('fakeScroll--hasBar');
}

@yairEO
Copy link
Owner

yairEO commented Oct 3, 2020

Why did you remove it? moveBar is not the place for it.

You should not change the source code or you'll be out-of-sync with future updates...

@ataylor32
Copy link
Author

You can look at #18 for context. I couldn't get that to work correctly without the change I mentioned in my previous comment. moveBar seemed like an appropriate place for it because that's where the .fakeScroll__bar div gets display: none added or removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants