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

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


git-svn-id: http://core.svn.wordpress.org/trunk@28516 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2014-06-08 18:48:16 +00:00
parent 8ded986462
commit 550a0ef768
3 changed files with 16 additions and 3 deletions

View File

@ -170,7 +170,7 @@ function twentythirteen_scripts_styles() {
wp_enqueue_script( 'jquery-masonry' );
// Loads JavaScript file with functionality specific to Twenty Thirteen.
wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '2014-03-18', true );
wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '2014-06-08', true );
// Add Source Sans Pro and Bitter fonts, used in the main stylesheet.
wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );

View File

@ -50,6 +50,19 @@
nav.toggleClass( 'toggled-on' );
} );
// Fix sub-menus for touch devices.
if ( 'ontouchstart' in window ) {
menu.find( '.menu-item-has-children > a' ).on( 'touchstart.twentythirteen', function( e ) {
var el = $( this ).parent( 'li' );
if ( ! el.hasClass( 'focus' ) ) {
e.preventDefault();
el.toggleClass( 'focus' );
el.siblings( '.focus' ).removeClass( 'focus' );
}
} );
}
// Better focus for hidden submenu items for accessibility.
menu.find( 'a' ).on( 'focus.twentythirteen blur.twentythirteen', function() {
$( this ).parents( '.menu-item, .page_item' ).toggleClass( 'focus' );

View File

@ -2895,8 +2895,8 @@ footer.entry-meta {
color: #141412;
}
.toggled-on .nav-menu li a:hover,
.toggled-on .nav-menu ul a:hover {
.toggled-on .nav-menu > li a:hover,
.toggled-on .nav-menu > ul a:hover {
background-color: #db572f;
color: #fff;
}