Reputation: 6268
This is what i have
<script type="text/javascript">
jQuery(function(){
jQuery("#menu").click(function () {
jQuery("#menu-open").slideDown("slow");
});
});
</script>
How to automatically close the menu when the user clicks again?
Upvotes: 0
Views: 374
Reputation: 1205
$(function(){
$("#menu").click(function () {
if(!$("#menu-open").is(":visible")){
$("#menu-open").slideDown("slow");
} else {
$("#menu-open").slideUp("slow");
}
});
});
here is a demo: http://jsfiddle.net/nn007/9FehL/2/
Upvotes: 1
Reputation: 27051
<script type="text/javascript">
$(function(){
$("#menu").click(function () {
$("#menu-open").fadetoggle();
});
});
</script>
use this, but im not use if you want it to fade or slide? since you ask for fadein but you use slide
You can also use .slidetoggle();
If you want to read more about fadetoggle, read this Here
Upvotes: 0