Quantcast
Channel: Hover function in jQuery doesn't work - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Hover function in jQuery doesn't work

$
0
0

I have fourli div that have inside a link of an image (so they're four links and four images), but I can't understand why the hover function doesn't work here .

The error is :

element.hover isn't a function:

var element =$("li div")var element_link = element.find("a");var element_img = element.find("img");element_img.css("opacity","0.5");element_link.each(function(index, element) {    element.hover(    function(){element_img[index].animate({opacity:1}),250},    function(){element_img[index].animate({opacity:0.5}),250}    );});

How can I fix this problem?


Viewing all articles
Browse latest Browse all 3

Trending Articles