Skip to content

Instantly share code, notes, and snippets.

@hanssens
Created November 30, 2011 08:21
Show Gist options
  • Save hanssens/1408421 to your computer and use it in GitHub Desktop.
Save hanssens/1408421 to your computer and use it in GitHub Desktop.
[PHP] Wordpress Dynamic Menu
#top-navigation ul ul a {
background:#333;
height:auto;
line-height:1em;
padding:10px;
width: 160px;
background-image: -moz-linear-gradient(100% 100% 90deg, #474747, #939393);
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#939393), to(#474747));
}
#top-navigation ul ul {
padding-bottom:10px;
background-color:#474747;
-moz-border-radius-bottomleft: 10px;
-webkit-border-bottom-left-radius: 10px;
-moz-border-radius-bottomright: 10px;
-webkit-border-bottom-right-radius: 10px;
}
#top-navigation ul ul {
display:none;
}
#top-navigation ul li:hover > ul {
display:block;
}
<?php
wp_enqueue_script('jquery');
wp_enqueue_script('unitzNav', get_bloginfo('template_directory')."/navigation.js");
?>
/* navigation file*/
jQuery(document).ready(function($) {
//initial the menus
$("ul.menu li").mouseover(function() {
$(this).find("ul.sub-menu").animate({"height": "show", "opacity": "show"}, 800, "swing");
$(this).hover(function() {}, function(){
$(this).find("ul.sub-menu").animate({"height": "hide", "opacity": "hide"}, "slow");
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment