Created
May 3, 2012 12:55
-
-
Save mpakus/2585435 to your computer and use it in GitHub Desktop.
Sliding menu (JQuery)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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