jquery - Show only one hidden div -
i'm hidding 2 divs , want make shown 1 of them in same time.
for example if click on first - shows up. click on second , first hides , show second div.
<div id="showmenu">click here</div> <div class="menu" style="display: none;"><ul><li>button1</li><li>button2</li><li>button3</li></ul></div> <br><br> <div id="showmenu2">click here</div> <div class="menu2" style="display: none;"><ul><li>button1</li><li>button2</li><li>button3</li></ul></div> $(document).ready(function() { $('#showmenu').click(function() { $('.menu').toggle("slide"); }); }); $(document).ready(function() { $('#showmenu2').click(function() { $('.menu2').toggle("slide"); }); });
use :
$(document).ready(function() { $('#showmenu').click(function() { $('.menu').toggle("slide"); $('.menu2').hide("slide");//hide menu2 when menu clicked }); $('#showmenu2').click(function() { $('.menu2').toggle("slide"); $('.menu').hide("slide");//hide menu when menu2 clicked }); });
Comments
Post a Comment