I tried to detect which mouse button -if any- is the user pressing during a mousemove event under jQuery, but I\'m getting ambiguous results:
no button press
Those variables are updated when the mousedown
event (amongst others) fires; you're seeing the value that remains from that event. Note that they are properties of that event, not of the mouse itself:
Description: For key or button events, this attribute indicates the specific button or key that was pressed.
There is no value for "no button press", because the mousedown
event will never fire to indicate that there's no button being pressed.
You'll have to keep your own global [boolean] variable and toggle it on/off on mousedown
/mouseup
.
mousemove
event firing will prevent this from working properly. However, there's really not much you can do about that.