Fix tapping on the menu in iOS and Android, fixes #29365 for trunk

Built from https://develop.svn.wordpress.org/trunk@29770


git-svn-id: http://core.svn.wordpress.org/trunk@29542 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-09-26 23:02:16 +00:00
parent 3a724fcf81
commit 0a4d4a3d93
2 changed files with 62 additions and 58 deletions

View File

@ -175,7 +175,9 @@ $(document).ready( function() {
lastClicked = false,
menu = $('#adminmenu'),
pageInput = $('input.current-page'),
currentPage = pageInput.val();
currentPage = pageInput.val(),
isIOS = /iPhone|iPad|iPod/.test( navigator.userAgent ),
isAndroid = navigator.userAgent.indexOf( 'Android' ) !== -1;
// when the menu is folded, make the fly-out submenu header clickable
menu.on('click.wp-submenu-head', '.wp-submenu-head', function(e){
@ -224,7 +226,7 @@ $(document).ready( function() {
if ( 'ontouchstart' in window || /IEMobile\/[1-9]/.test(navigator.userAgent) ) { // touch screen device
// iOS Safari works with touchstart, the rest work with click
mobileEvent = /Mobile\/.+Safari/.test(navigator.userAgent) ? 'touchstart' : 'click';
mobileEvent = isIOS ? 'touchstart' : 'click';
// close any open submenus when touch/click is not on the menu
$(document.body).on( mobileEvent+'.wp-mobile-hover', function(e) {
@ -282,6 +284,7 @@ $(document).ready( function() {
});
}
if ( ! isIOS && ! isAndroid ) {
menu.find('li.wp-has-submenu').hoverIntent({
over: function() {
var b, h, o, f, m = $(this).find('.wp-submenu'), menutop, wintop, maxtop, top = parseInt( m.css('top'), 10 );
@ -349,6 +352,7 @@ $(document).ready( function() {
$(e.target).closest('li.menu-top').removeClass('opensub');
});
}
// Move .updated and .error alert boxes. Don't move boxes designed to be inline.
$('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2');

File diff suppressed because one or more lines are too long