Skip to content
This repository was archived by the owner on Nov 27, 2018. It is now read-only.

Comments

When using disableBodyScroll, set stored scrollTo value to the initia…#91

Closed
bwshen wants to merge 3 commits intogromo:masterfrom
bwshen:master
Closed

When using disableBodyScroll, set stored scrollTo value to the initia…#91
bwshen wants to merge 3 commits intogromo:masterfrom
bwshen:master

Conversation

@bwshen
Copy link

@bwshen bwshen commented May 19, 2016

…l scrolled position, as well as upon subsequent calls to init.

Hi Gromo, didn't find any information on the best way to submit proposed changes. If you'd prefer that i open up an issue or something else instead let me know.

I have the use case where i programatically scroll to a position initially. however when i mousewheel with disableBodyScroll: true, the mousewheel, assumes that initial scroll is 0, instead of the actual value and scrolls there.

thxs!

…l scrolled position, as well as upon subsequent calls to init
@gromo
Copy link
Owner

gromo commented May 20, 2016

How do you change scroll position? Do you use jQuery scrollTop/scrollLeft? Can you prepare example with wrong behavior on jsFiddle.net using original jquery.scrollbar.js file?

@bwshen
Copy link
Author

bwshen commented May 20, 2016

here's a jsfiddle:
https://jsfiddle.net/tjqgxkd9/3/

When you attempt to use the mousewheel, if you mousewheel down, you are scrolled to the top, if you mousewheel up, it doesn't scroll.

@bwshen
Copy link
Author

bwshen commented May 20, 2016

apologies, try https://jsfiddle.net/tjqgxkd9/5/

@gromo
Copy link
Owner

gromo commented May 20, 2016

Pretty interesting. If you use mousewheel over scrollbar it works correctly. Idea was that disableBodyScroll handles mousewheel and trigger the same event for scrollbars. I will look at the code in next few days

Upd. fix should be like this: trigger mouseenter event on scrollbar and only then use mousewheel event

@bwshen
Copy link
Author

bwshen commented May 24, 2016

something like this?

@gromo
Copy link
Owner

gromo commented May 26, 2016

https://jsfiddle.net/tjqgxkd9/6/ - quick hack

@gromo
Copy link
Owner

gromo commented May 26, 2016

But much better if you set scrollTop offset first and only then initialize scrollbar

… the scrollable container to handle changes in stored scrollValue to support disableBodyScroll
@gromo gromo closed this Jul 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants