![]() buttons if any, a number indicating the button(s) pressed on any mouse event.Works on events caused by clicking the button (e.g. button if any, the number of the button that was pressed when the mouse event was fired (usually 0 = main button, 1 = middle button, 2 = right button).altKey true if alt key was pressed when the event was fired.addEventListener ( 'mousedown', event => ) When inside an eventh handler we have access to lots of properties.įor example on a mouse event we can check which mouse button was pressed by checking the button property of the event object: const link = document. We need to apply throttling, which is something we’ll talk more when we’ll analyze scrolling. ![]() Mousedown, mousemove and mouseup can be used in combination to track drag-and-drop events.īe careful with mousemove, as it fires many times during the mouse movement. In the case of dblclick, click is also fired two times. When you track a click event, it’s like tracking a mousedown followed by a mouseup event. on a right mouse button clickĮvents overlap.
0 Comments
Leave a Reply. |