Make the responsive menu usable with a mouse, fix non-folded and :focus styles, toggle the submenus on touchend/click. Fixes #26086.
git-svn-id: https://develop.svn.wordpress.org/trunk@26516 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8eedbe32ac
commit
eb2767a578
@ -11823,6 +11823,14 @@ li#wp-admin-bar-menu-toggle {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.auto-fold #adminmenu a.menu-top:focus + .wp-submenu,
|
||||
.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu {
|
||||
position: relative;
|
||||
left: -1px;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/* Remove submenu headers and adjust sub meu*/
|
||||
#adminmenu .wp-submenu .wp-submenu-head {
|
||||
display: none;
|
||||
|
@ -251,6 +251,11 @@ $(document).ready( function() {
|
||||
if ( isNaN(top) || top > -5 ) // meaning the submenu is visible
|
||||
return;
|
||||
|
||||
if ( menu.data('wp-responsive') ) {
|
||||
// The menu is in responsive mode, bail
|
||||
return;
|
||||
}
|
||||
|
||||
menutop = $(this).offset().top;
|
||||
wintop = $(window).scrollTop();
|
||||
maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar
|
||||
@ -275,6 +280,11 @@ $(document).ready( function() {
|
||||
$(this).addClass('opensub');
|
||||
},
|
||||
out: function(){
|
||||
if ( menu.data('wp-responsive') ) {
|
||||
// The menu is in responsive mode, bail
|
||||
return;
|
||||
}
|
||||
|
||||
$(this).removeClass('opensub').find('.wp-submenu').css('margin-top', '');
|
||||
},
|
||||
timeout: 200,
|
||||
@ -283,8 +293,18 @@ $(document).ready( function() {
|
||||
});
|
||||
|
||||
menu.on('focus.adminmenu', '.wp-submenu a', function(e){
|
||||
if ( menu.data('wp-responsive') ) {
|
||||
// The menu is in responsive mode, bail
|
||||
return;
|
||||
}
|
||||
|
||||
$(e.target).closest('li.menu-top').addClass('opensub');
|
||||
}).on('blur.adminmenu', '.wp-submenu a', function(e){
|
||||
if ( menu.data('wp-responsive') ) {
|
||||
// The menu is in responsive mode, bail
|
||||
return;
|
||||
}
|
||||
|
||||
$(e.target).closest('li.menu-top').removeClass('opensub');
|
||||
});
|
||||
|
||||
@ -541,18 +561,28 @@ $(document).ready( function() {
|
||||
// Add menu events
|
||||
$adminmenu.on( 'touchstart.wp-responsive', 'li.wp-has-submenu > a', function() {
|
||||
scrollStart = $window.scrollTop();
|
||||
}).on( 'touchend.wp-responsive', 'li.wp-has-submenu > a', function( event ) {
|
||||
if ( ! $adminmenu.data('wp-responsive') || $window.scrollTop() !== scrollStart ) {
|
||||
}).on( 'touchend.wp-responsive click.wp-responsive', 'li.wp-has-submenu > a', function( event ) {
|
||||
if ( ! $adminmenu.data('wp-responsive') ||
|
||||
( event.type === 'touchend' && $window.scrollTop() !== scrollStart ) ) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$( this ).find( 'li.wp-has-submenu' ).removeClass( 'selected' );
|
||||
$( this ).parent( 'li' ).addClass( 'selected' );
|
||||
$( this ).parent( 'li' ).toggleClass( 'selected' );
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
self.trigger();
|
||||
$document.on( 'wp-window-resized.wp-responsive', $.proxy( this.trigger, this ) );
|
||||
|
||||
// This needs to run later as UI Sortable may be initialized later on $(document).ready()
|
||||
$window.on( 'load.wp-responsive', function() {
|
||||
var width = navigator.userAgent.indexOf('AppleWebKit/') > -1 ? $window.width() : window.innerWidth;
|
||||
|
||||
if ( width <= 782 ) {
|
||||
self.disableSortables();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user