jQuery panels - close one when opening another

Posted by justme on Stack Overflow See other posts from Stack Overflow or by justme
Published on 2012-05-31T10:37:23Z Indexed on 2012/05/31 10:40 UTC
Read the original article Hit count: 231

Filed under:
|
|

I have two slide panel in the same page. Need that, when one is open and the and user clicks on the other one, that makes, at the same time, close the first one when opening the second. Now they are overlapping...

Can you help me, please? thanks

This is what i have on the page:

I have two slide panel in the same page. Need that, when one is open and the and user clicks on the other one, that makes, at the same time, close the first one when opening the second. Now they are overlapping...

Can you help me, please? thanks

This is what i have on the page

<script type="text/javascript" src="jquery.js"></script>


<script type="text/javascript">

$(document).ready(function(){
$(".btn-slide").click(function(){
    $("#panel").slideToggle('fast');
  $("#panel2").slideToggle("fast");
  $(this).toggleClass("active");
});
});

$(document).ready(function(){
$(".btn-slide2").click(function(){
  $("#panel2").slideUp('fast');
  $("#panel").slideToggle("fast");
  $(this).toggleClass("active");
});

</script>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about slider