JQuery function. works in 1.8.3, but not in 1.9.1

I have a function that works with jQuery 1.8.3, but when I upgrade to 1.9.1, it no longer works, but there is no change in the documentation. Does anyone know how to fix this?

$(document).on("hover", "#cart-left", function(){
    $("#cart").addClass('active');
});

http://jsfiddle.net/michalcerny/R9HZp/

Thanks for the support!

+5
source share
3 answers

In 1.9.1 you should use mouseover

$(document).on("mouseover", "#cart-left", function(){
    $("#cart").addClass('active');
});
+8
source

Reduction Status hover

As with jQuery 1.8, the transcript is hoverout of date. See jQueryon() Documentation :

Deprecated from jQuery 1.8: the name "hover" is used as an abbreviation for the string "mouseenter mouseleave"

jQuery 1.9, hover . . jQuery 1.9

Alternative

, mouseenter. :

$(document).on("mouseenter", "#cart-left", function(){
     $("#cart").addClass('active');
});

. jsFiddle demo

on()

, on(), , DOM (.. ), document. , :

$("#cart-left").on("mouseenter", function(){
    $("#cart").addClass('active');
});
+5
+2

All Articles