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.
EDIT: here is the markup :
<ul>
<li id="slide1-button" class="slideButton">Entreprise</li>
<li id="slide2-button" class="slideButton">Culture</li>
<li id="slide3-button" class="slideButton">Institution</li>
</ul>
<div id="slide-wrapper">
<div id="slide1" class="slide">
<span class="closeall"></span><!-- content -->
</div>
<div id="slide2" class="slide">
<span class="closeall"></span><!-- content -->
</div>
<div id="slide3" class="slide">
<span class="closeall"></span><!-- content -->
</div>
</div> <!-- /#slide-wrapper -->