All the others (not this)

Posted by Narcís on Stack Overflow See other posts from Stack Overflow or by Narcís
Published on 2012-04-12T09:49:26Z Indexed on 2012/04/12 11:29 UTC
Read the original article Hit count: 161

Filed under:
|

I have different divs repeated in the same page. This is the example simplified: http://jsfiddle.net/8gPCE/

What I try to do is:
-Click on a green and only his red fadeOut
-The other red fadeIn
-And when I click to anywhere else like the background all the red fadeIn

I have been hour trying and I don't find the 3 things at the same time.

Something like this doesn't work.(and I just try the 2 first things):

$(function(){

    $("#green").click(function() {
        $(this).siblings(".red").fadeOut("slow");
        $(this).parent().not(this).children(".red").fadeIn("slow");
    });

})

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about this