-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
Unexpected behaviour when using scroll() #120
Comments
Good day! Ugh, that was a though one... Took me quite a while to figure out where the problem lies. Turns out this is happening because I'm using a After a bit of research I've found the Until then you can fix this with a this.messageElements.changes
.pipe(take(1))
.subscribe(() => {
setTimeout(() => {
let scrollVal = firstMsg.offsetTop - curOffset;
this.scrollbarInstance.scroll({ y: scrollVal });
});
}); Or with native scrolling since the clipping wont happen there: this.messageElements.changes
.pipe(take(1))
.subscribe(() => {
let scrollVal = firstMsg.offsetTop - curOffset;
this.scrollbarInstance.getElements().viewport.scrollTop = scrollVal;
}); |
Amazing! Thank you so much for your quick response - and fix! Much appreciated, have a good day! |
I've fixed this bug in v1.7.3 please test it and provide some feedback. Thanks! |
@KingSora Just tried it now and the bug is no longer present - thanks so much for the fix! |
No problem, glad I could help! |
Good Day, KingSora!
I am currently building a chat application, and one of the features is a lazy loading chat log - so when the user scrolls to the top more messages will load. I have created this functionality and with the regular scrollbar it works flawlessly. I got it working with OverlayScrollbars with a few minor adjustments using the scroll method (and passing a y value). It works when there is a lot of content in the scroll box (and when the track is quite small, maybe its because of this?) but when there isn't a lot of content (i.e. initially) it doesn't scroll to the right position.
I extracted the relevant code and made a Github repo: https://github.com/Devstackr8/overlay-scrollbars-lazy-load
I tried to setup a StackBlitz: https://stackblitz.com/edit/github-cq5cak
All the code is there, but for some reason the OverlayScrollbars package isn't installing - maybe you can get it working.
In the example, there are 2 pages (which you can access via tabs) - one shows the example without OverlayScrollbars - which works perfectly. And then the other page is the same example but using OverlayScrollbars. Keep on scrolling up to load new messages.
Many thanks in advance.
The text was updated successfully, but these errors were encountered: