I'm using jQuery to develop in web environment.
I want to know why
$("#a#trigger").trigger('mouseenter'); $("#a#trigger").trigger('hover'); $("#a#trigger").trigger('mouseover');
All 3 of those aren't working to activate a hover function that I have.
$(function() { $('a#trigger').hover(function(e) { $('div#pop-up').show(); }, function() { $('div#pop-up').hide(); }); }); });
a#trigger
is the name of the anchor, and #pop-up
is a div element in my web.
The problem is that I want to mouse over some event in FullCalendar plugin and those functions aren't working. Thanks.
jQuery mouseover() Method The mouseover event occurs when the mouse pointer is over the selected element. The mouseover() method triggers the mouseover event, or attaches a function to run when a mouseover event occurs.
The mouseout() method triggers the mouseout event, or attaches a function to run when a mouseout event occurs. Note: Unlike the mouseleave event, the mouseout event is triggered if a mouse pointer leaves any child elements as well as the selected element.
The mouseover event is sent to an element when the mouse pointer enters the element. Any HTML element can receive this event.
You are on the right track, the problem is the extra #
in the selector, just remove the first hash:
$("a#trigger").trigger('mouseenter');
Note that since IDs must be unique, there is no need to specify the element type, $('#trigger')
is more efficient.
Also note that:
Deprecated in jQuery 1.8, removed in 1.9: 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 examineevent.type
to determine whether the event ismouseenter
ormouseleave
. Do not confuse the"hover"
pseudo-event-name with the.hover()
method, which accepts one or two functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With