Twenty Twelve: make submenu links work correctly on tablets. Props tar.gz, purzlbaum, DavidTheMachine. See #24767.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2014-06-08 19:00:14 +00:00
parent 3c7904727b
commit 8e4aed3d8a
1 changed files with 12 additions and 0 deletions

View File

@ -40,4 +40,16 @@
$( '.main-navigation' ).find( 'a' ).on( 'focus.twentytwelve blur.twentytwelve', function() {
$( this ).parents( '.menu-item, .page_item' ).toggleClass( 'focus' );
} );
if ( 'ontouchstart' in window ) {
$( '.menu-item-has-children > a' ).on( 'touchstart.twentytwelve', function( e ) {
var el = $( this ).parent( 'li' );
if ( ! el.hasClass( 'focus' ) ) {
e.preventDefault();
el.toggleClass( 'focus' );
el.siblings( '.focus').removeClass( 'focus' );
}
} );
}
} )( jQuery );