Skip to content

Instantly share code, notes, and snippets.

@mpakus
Created May 3, 2012 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mpakus/2585435 to your computer and use it in GitHub Desktop.
Save mpakus/2585435 to your computer and use it in GitHub Desktop.
Sliding menu (JQuery)
<html>
<head>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<style type="text/css">
body{
margin:0;
padding:0;
}
.menu{
position: absolute;
width: 600px;
height: 180px;
background: gray;
top: -180px;
border-bottom: 10px solid red;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
M = $(".menu");
M.css( {left: $('body').width()/2 - 300 + "px"} );
M.toggle(
function() {
M.animate( {top:"0px"} );
},
function() {
M.animate( {top:"-180px"} );
}
);
});
</script>
</head>
<body>
<div class="menu"></div>
</bodY>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment