Return to Snippet

Revision: 42343
at March 3, 2011 14:48 by happynuclear


Initial Code
//the container wrapping the menu
var menuContainer = '#mainnavigation';

$(document).ready(function() {
	
   //hover display for main menu items
   $(menuContainer+' ul.menu li').hover(
		
   //on enter
   function() {
      selectedItem = this.id;
      $(menuContainer+' ul li#'+selectedItem+' ul.sub-menu').fadeIn('fast');
   },		
   //on leave
   function() {
      selectedItem = this.id;
      $(menuContainer+' ul li#'+selectedItem+' ul.sub-menu').fadeOut('fast');
   }
   );
});

Initial URL
http://www.happynuclear.com/sandbox/wpsubdropper/version1.html

Initial Description
When applied to a page, this script converts any sub-menus created in the Wordpress menu editor into drop-down menus without having to specify each menu item individually. Fades in sub-menu of selected list item quickly, then fades out when leaving list item or sub-menu. See url above.

Only decided to post this because I couldn't find anything similar and was sick of working with inefficient menu creator plugins in WP.

Initial Title
Jquery convert Wordpress sub-menus into drop-down menus

Initial Tags
javascript, html, jquery

Initial Language
jQuery