opening a div closing the others

Posted by Mael on Stack Overflow See other posts from Stack Overflow or by Mael
Published on 2010-04-11T20:20:31Z Indexed on 2010/04/11 20:23 UTC
Read the original article Hit count: 263

Filed under:
|

I'm trying to make a sliding panel using .animate function because I want it to slide left/right (jQuery allow slideUp and slideDown, but no other directions). I made the animation like this :

jQuery('#slide1-button').toggle(
function(){jQuery('#slide1').animate({right: 700},600);},
function(){jQuery('#slide1').animate({right: -700},600);}
);

jQuery('#slide2-button').toggle(
function(){jQuery('#slide2').animate({right: 700},600);},
function(){jQuery('#slide2').animate({right: -700},600);}
);

jQuery('#slide3-button').toggle(
function(){jQuery('#slide3').animate({right: 700},600);},
function(){jQuery('#slide3').animate({right: -700},600);}
);

Now I would like the opened panel to hide when I open an other one.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about toggle