Simple "sticky" menu, remembers the open parents and the current parent is always open

git-svn-id: https://develop.svn.wordpress.org/trunk@8953 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2008-09-22 08:01:42 +00:00
parent 6b8432bbb8
commit f8d904538d

View File

@ -54,12 +54,28 @@ jQuery( function($) {
effect = 'slideToggle';
}
ul[effect]().parent().toggleClass( 'wp-menu-open' );
$('#adminmenu li.wp-has-submenu').each(function(i, e) {
var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c';
setUserSetting( 'm'+i, v );
});
return false;
};
jQuery('#adminmenu li.wp-has-submenu > a').click( function() { return menuToggle( jQuery(this).siblings('ul') ); } );
$('#adminmenu li.wp-has-submenu').each(function(i, e) {
var v = getUserSetting( 'm'+i );
jQuery('#dashmenu li.wp-has-submenu').bind( 'mouseenter mouseleave', function() { return menuToggle( jQuery(this).children('ul'), 'toggle' ); } );
if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open
if ( 'o' == v ) $(e).addClass('wp-menu-open');
else if ( 'c' == v ) $(e).removeClass('wp-menu-open');
});
$('#adminmenu li.wp-has-submenu > a').click( function() { return menuToggle( $(this).siblings('ul') ); } );
$('#dashmenu li.wp-has-submenu').bind( 'mouseenter mouseleave', function() { return menuToggle( $(this).children('ul'), 'toggle' ); } );
} );