I'm changing my codes to be compatible with jQuery 1.8 and I'm stuck with this hover
which doesn't work. When I used then same thing with a click
it worked. Here is my code, can anyone tell me where I'm going wrong?
$(document).on('hover', '.top-level', function (event) { $(this).find('.actionfcnt').show(); $(this).find('.dropfcnt').show(); }, function () { $(this).find('.dropfcnt').hide('blind', function () { $('.actionfcnt').hide(); }); });
jQuery hover() MethodThe hover() method specifies two functions to run when the mouse pointer hovers over the selected elements. This method triggers both the mouseenter and mouseleave events. Note: If only one function is specified, it will be run for both the mouseenter and mouseleave events.
hover() is deprecated #66.
The mouseover() method triggers the mouseover event, or attaches a function to run when a mouseover event occurs. Note: Unlike the mouseenter event, the mouseover event triggers if a mouse pointer enters any child elements as well as the selected element.
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.
Source: http://api.jquery.com/on/#additional-notes
That pretty much says it all, you cant use "hover" for that:
$(document).on('mouseenter','.top-level', function (event) { $( this ).find('.actionfcnt').show(); $( this ).find('.dropfcnt').show(); }).on('mouseleave','.top-level', function(){ $( this ).find('.dropfcnt').hide('blind', function(){ $('.actionfcnt').hide(); }); });
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