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

Scrollbar doesn't work if page was scrolled with native scrollbar #342

Closed
andrei-varchanka opened this issue Jan 6, 2021 · 7 comments · Fixed by #349
Closed

Scrollbar doesn't work if page was scrolled with native scrollbar #342

andrei-varchanka opened this issue Jan 6, 2021 · 7 comments · Fixed by #349
Labels

Comments

@andrei-varchanka
Copy link

andrei-varchanka commented Jan 6, 2021

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/ngx-scrollbar

Steps to reproduce:

  1. Reduce window height so native scrollbar appears
  2. When scroll offset of the page is 0, ngx-scrollbar works fine
  3. Scroll the page and try to scroll the content inside ngx-scrollbar using scrollbar

Expected Behavior

working scrollbar

Actual Behavior

content is not scrolling. (it can be scrolled only using mouse wheel but i want a working scrollbar)

Environment

  • Angular:
  • ngx-scrollbar:
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): any

https://media.giphy.com/media/kG2SL1UGEjYoLxtYJm/giphy.gif

@andrei-varchanka
Copy link
Author

Hey @MurhafSousli did you start investigating? take a look please

@MurhafSousli
Copy link
Owner

@andrei-varchanka I couldn't replicate this in the the demo, could it be caused by the stackblitz env because it is wrapped in an iframe? can you reproduce it in the demo? https://ngx-scrollbar.netlify.com/

@andrei-varchanka
Copy link
Author

andrei-varchanka commented Jan 18, 2021

@MurhafSousli https://ngx-scrollbar.netlify.com/ doesn't use native scroll for the page so i moved out the content from ngx-scrollbar to demonstrate

HwVideoEditor_2021_01_18_154636.mp4

@MurhafSousli
Copy link
Owner

It seems that there is a problem with the mouse pointer position before dragging the scrollbar at that point..

A good starting point is to look at the dragging methods in https://github.com/MurhafSousli/ngx-scrollbar/blob/master/projects/ngx-scrollbar/src/lib/scrollbar/thumb/thumb.ts#L86

Help is apperciated!

@andrei-varchanka
Copy link
Author

@MurhafSousli i found the fix, commit it please
image

@andrei-varchanka
Copy link
Author

Current: return this.clientRect.top;
Expected: return this.clientRect.top + window.pageYOffset;

@MurhafSousli
Copy link
Owner

@andrei-varchanka Thank you very much!

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

Successfully merging a pull request may close this issue.

2 participants