Skip to content

Instantly share code, notes, and snippets.

@emayk
Created March 21, 2012 11:06
Show Gist options
  • Save emayk/2146220 to your computer and use it in GitHub Desktop.
Save emayk/2146220 to your computer and use it in GitHub Desktop.
snippet: Jquery Dropdown_menu
function dropdown_menu() {
$("#sub-menu-id a, .subnav a");
$(" #sub-menu-id ").css({
display: "none",
opacity: "1"
}); // fix for opera browser
$("#sub-menu-id li").each(function() {
var $subNav = jQuery(this).find('ul:first');
$(this).hover(function() {
$subNav.stop().css({
overflow: "hidden",
height: "auto",
display: "none"
}).slideDown(350, function() {
$(this).css({
overflow: "visible",
height: "auto"
});
});
}, function() {
$subNav.stop().slideUp(350, function() {
$(this).css({
overflow: "hidden",
display: "none"
});
});
});
});
}
//USAGE
<script>
jQuery(document).ready(function(){ dropdown_menu(); });
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment