JQuery: how to cause a hang?
How can I activate the second hover function?
$('#adm1n-toolbar').hover( function() { ... }, function() { ... } ); $('#adm1n-toolbar-content select').change(function(e) { ... $('#adm1n-toolbar').trigger('mouseout'); });
mouseout or mouseleave do not work.
+4
Alex g
source share2 answers
It works great if you use mouseleave
, which hover
uses behind the scenes
demo at http://jsfiddle.net/gaby/6fyeS/
+9
Gaby aka G. petrioli
source shareYou cannot externally use the second function in hover()
. However, since hover()
is just a shortcut to mouseenter()
and mouseleave()
, you can assign them separately so you can run them as needed. Try the following:
$('#adm1n-toolbar') .mouseenter(function() { // ... }) .mouseleave(function() { // ... }); $('#adm1n-toolbar-content select').change(function(e) { $('#adm1n-toolbar').trigger('mouseleave'); });
+8
Rory mccrossan
source share