From additional notes on jquery docs on on
Deprecated as of jQuery 1.8: The name "hover" used as a shorthand for
the string "mouseenter mouseleave". It attaches a single event handler
for those two events, and the handler must examine event.type to
determine whether the event is mouseenter or mouseleave. Do not
confuse the "hover" pseudo-event-name with the .hover() method, which
accepts one or two functions.
Thus when you use hover with on, it assumes you are using this hover which is
A function to execute when the mouse pointer enters or leaves the element.
Thus either use,
$(document).on('hover', 'ul.settings-links', function (e) {
if (e.type == "mouseenter") {
alert("show");
} else {
alert("hide");
}
});
OR
$('body').on({
mouseenter: function() {
$(this).find('ul.settings-links').fadeIn();
},
mouseleave: function() {
$(this).find('ul.settings-links').fadeOut();
}
}, 'div.settings-container');
You cannot use the hover which accepts two functions as parameters.