What mouse event?

I noticed that if I click on the button, move the pointer out of the button area, and then return to it without releasing the button, it still remembers that I have a button with the button pressed.

I'm trying to set the button style accordingly, can someone enlighten me as the right JavaScript / jQuery event to use for this?

I would really like to use some kind of counter for this.

EDIT: current hacker solution OK;

Globally called hotbutton

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

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

$(document).onmouseup{hotbutton=''}
+3
source share
3 answers

What am I doing:

  • Add a style ("hot") in the mouseover handler;
  • ( "" ) mousedown;
  • "" mouseup;
  • "" "" .

, "click".

+2

mousedown :

$("#button_id").mousedown(function(){
    $(this).css('color', '#00ff00');
});
+1

Why use jQuery? Set it to CSS and the browser will do it for you (right?).

0
source

Source: https://habr.com/ru/post/1734767/


All Articles