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

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -