Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What mouse event?

I've noticed that if I mouse-down on a button, move my pointer from the button area, then return to it without releasing the button it still remembers that i have 'mouse-downed' on the button.

I'm trying to set button styles appropriately, could anyone enlighten me as the correct JavaScript/jQuery event to use for this?

I would really hate to use some sort of counter for this.

EDIT: OK current hacky solution;

Global called hotbutton

   $('.thisbutton').onmouseenter{if (hotbutton='thisbutton'){drawmousedowntheme();}} 

   $('.thisbutton').onmousedown{hotbutton='thisbutton';drawmousedowntheme();}

$(document).onmouseup{hotbutton=''}
like image 771
maxp Avatar asked Apr 28 '26 15:04

maxp


1 Answers

What I do is:

  • Add a style ("hot") in the mouseover handler;
  • Add another style ("active") in the mousedown handler;
  • Remove "active" in the mouseup handler;
  • Remove both "active" and "hot" in the mouseout handler

The actual important stuff I always bind to "click".

like image 65
Pointy Avatar answered Apr 30 '26 05:04

Pointy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!