I am building a website with a javascript scroll bar using the code in this tutorial . There is a demo with a tutorial here .
My problem is this: if the user clicks on the timeline to drag it and they click on the link, then when the mouse button is released, the browser interprets this as a click on the link. Therefore, it is very easy to easily move away from the timeline.
The behavior I would like is the following: clicking on the link only starts navigation if the mouse was not moved between mousedown and mouseup. If the mouse was moved when the button is held down, the link is not executed because the user is trying to move the timeline rather than clicking the link.
Is it possible? I have a feeling that we need the boolean variable is_mouse_moved , which is set to false in mousedown and true to mousemove. Then, on mouseup, we check whether the mouseup event needs to be "passed" to the browser. How can you say I'm not too familiar with js!
Any help was appreciated.
source share