Answer the question
In order to leave comments, you need to log in
How to fix scroll jump on mousemove?
Good evening!
Half a day I can not understand why when moving a custom scroll, it jumps.
Although if you remove window.scrollTo, then the custom scroll will move normally. Either something is wrong in the calculations, or the magic is hidden somewhere)
Link to fiddle:
https://jsfiddle.net/vgr6spuq/
Answer the question
In order to leave comments, you need to log in
Yes, there is not only a jump, your scroll goes somewhere beyond the lower border, of course, you have hung a handler for deleting the mousemove handler on mouseup, and who will delete the mouseup deletion handler? Corrected what I could. Better google how to make custom scrollbars than invent your own.
As mentioned above, the removal of the handler is not implemented.
Also a CSS version, without JavaScript:
It will be even shorter, and to change the "decoration" I would still look first of all towards CSS
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question