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
source share
2 answers

It works great if you use mouseleave , which hover uses behind the scenes

demo at http://jsfiddle.net/gaby/6fyeS/

+9
source

You 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
source

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


All Articles