jQuery hover() only triggers when mouse move -


i have button changes opacity when hovered: (works fine)

$('#btn').hover(function() {     $(this).animate({'opacity':1},100); }, function() {     $(this).animate({'opacity':.8},100); }); 

and when pressed moves down: (works fine too)

$('#btn').on('click',function(){     $(this).animate({'margin-top':'-100px'},400); }); 

problem: when button moves, moves away hover area, but first hover state still active (the first hover state should active when mouse hovered on button). however, if move mouse there on, second state triggers jquery notice mouse moves.

is there way hover() trigger if mouse not moved?

use $(this).trigger("mouseout")

this cause correct hover() handler fire.

demo: http://jsfiddle.net/alan0xd7/va87ff96/


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

php - Mongodb connectivity error -