M
M
madc0de2020-04-30 22:29:49
JavaScript
madc0de, 2020-04-30 22:29:49

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

2 answer(s)
T
twobomb, 2020-04-30
@twobomb

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.

V
Vadym Masiuk, 2020-05-01
@7TyLe

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 question

Ask a Question

731 491 924 answers to any question