JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/ui-lightness/jquery-ui.css">
<div id='menu_tab'>Menu Tab<div class='close'>Close</div></div>
<div id='menu_box'>
<div id='menu_content'>menu content</div>
</div>
CSS
#menu_box {
position: relative;
padding: 20px;
background: yellow;
border: 2px dashed orange;
}
#menu_content {
position: relative;
}
#menu_tab {
position: relative;
padding: 6px;
color: blue;
cursor: pointer;
}
JavaScript
var opened = false;
var timeout;
$("#menu_tab").click(function(){
if(timeout) {
clearTimeout(timeout);
timeout = null;
}
if(opened){
$("#menu_box").animate({"top": "+=83px"}, "slow");
}else{
$("#menu_box").animate({"top": "-=83px"}, "slow");
timeout = setTimeout(function(){
timeout = null;
$("#menu_tab").click();
}, 2000);
}
$("#menu_content").slideToggle("slow");
$("#menu_tab .close").toggle();
opened = !opened;
});