Trying to override the handlerOut (mouseleave) effect from another function:
$( '.main-nav .menu-item' ).hover(
function() {
$( '> .sub-menu' , this )
.stop( true, true )
.fadeIn( { duration: 250 } );
}, function() {
$( '> .sub-menu' , this )
.stop( true, true )
.fadeOut( { duration: 250 } );
} );
I don’t want the elements to fade out but not sure how to override this. Is it possible to stop the hover effect from happening using another function?
You can remove the event handlers using
.off
and attach your own instead. You have to make sure that your script runs after the other script.or just the mouseleave event if you don’t want to change the over effect:
Just disable mouseleave event by calling
.off('mouseleave')
, additionally if you want to do some other work, use.mouseleave