I would do this:
At first I use the $(nav)
selector, but you can wrap it in your code first. In addition, you will need to place your menu: position: relative;
OR position: absolute;
To make this a slide:
$(nav).animate({"top":$(nav).height() * -1},"slow");
To make it available:
$(nav).animate({"top":0},"slow");
If you want to do this popup after 3 seconds, here we go:
function MenuOut() { $(nav).animate({"top":$(nav).height() * -1},"slow"); }
and you put this on your Js page:
$(function() { setTimeout("MenuOut",3000); });
Now the button:
function MenuIn() { $(nav).animate({"top":0},"slow"); }
and you bind it to your button as follows:
$('#theButton').on( { click: function() { $(this).animate({"top":$(this).height() * -1},"slow",function() { MenuIn(); }); } });
source share