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

git-svn-id: https://develop.svn.wordpress.org/trunk@29770 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-09-26 23:01:52 +00:00
parent 1c8658f620
commit d34a54f1e4
1 changed files with 61 additions and 57 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');