Help filtering childs

Posted by lidermin on Stack Overflow See other posts from Stack Overflow or by lidermin
Published on 2010-04-19T21:25:06Z Indexed on 2010/04/19 21:33 UTC
Read the original article Hit count: 309

Filed under:

Hello, I have this jquery code:

$(".button-banc").hover(function() {
    $(".button-banc img")
        .animate({ top: "-21px" }, 200).animate({ top: "-17px" }, 200) // first jump
        .animate({ top: "-19px" }, 100).animate({ top: "-17px" }, 100) // second jump
        .animate({ top: "-18px" }, 100).animate({ top: "-17px" }, 100); // the last jump
});

The effect I want is: when you pass the mouse over an image this image should jump a bit. The problem is that I got "some" images with the class "button-banc" and I want this behaive:

When you pass the mouse over, "only the actual image" should jump. The problem is that with the code I posted, every image jumps.

How can I achieve this, please help; I want to make a generic way, so that if I add images with the class, they also behaive like that. Thanks.

© Stack Overflow or respective owner

Related posts about jQuery