Fix submenu position and state on folded admin menu, props sambauers, fixes #9956

git-svn-id: http://svn.automattic.com/wordpress/trunk@11483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-05-29 07:42:55 +00:00
parent ad038538e3
commit 7e52231ce1
3 changed files with 13 additions and 8 deletions

View File

@ -26,9 +26,8 @@ adminMenu = {
if ( $('body').hasClass('folded') ) {
this.fold();
} else {
this.restoreMenuState();
}
this.restoreMenuState();
},
restoreMenuState : function() {
@ -61,10 +60,16 @@ adminMenu = {
$('body').addClass('folded');
$('#adminmenu li.wp-has-submenu').hoverIntent({
over: function(e){
var m = $(this).find('.wp-submenu'), t = e.clientY, H = $(window).height(), h = m.height(), o;
if ( (t+h+10) > H ) {
o = (t+h+10) - H;
var m, b, h, o, f;
m = $(this).find('.wp-submenu');
b = m.parent().offset().top + m.height() + 1; // Bottom offset of the menu
h = $('#wpwrap').height(); // Height of the entire page
o = 60 + b - h;
f = $(window).height() + $('body').scrollTop() - 15; // The fold
if (f < (b - o)) {
o = b - f;
}
if (o > 1) {
m.css({'marginTop':'-'+o+'px'});
} else if ( m.css('marginTop') ) {
m.css({'marginTop':''});

File diff suppressed because one or more lines are too long

View File

@ -60,7 +60,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090522' );
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090528' );
$scripts->add_data( 'common', 'group', 1 );
$scripts->localize( 'common', 'commonL10n', array(
'warnDelete' => __("You are about to delete the selected items.\n 'Cancel' to stop, 'OK' to delete."),