WordPress.org

Make WordPress Core

Changeset 28700


Ignore:
Timestamp:
06/08/2014 06:59:45 PM (6 years ago)
Author:
lancewillett
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwelve/js/navigation.js

    r27606 r28700  
    4141        $( this ).parents( '.menu-item, .page_item' ).toggleClass( 'focus' );
    4242    } );
     43
     44  if ( 'ontouchstart' in window ) {
     45    $( '.menu-item-has-children > a' ).on( 'touchstart.twentytwelve', function( e ) {
     46      var el = $( this ).parent( 'li' );
     47
     48      if ( ! el.hasClass( 'focus' ) ) {
     49        e.preventDefault();
     50        el.toggleClass( 'focus' );
     51        el.siblings( '.focus').removeClass( 'focus' );
     52      }
     53    } );
     54  }
    4355} )( jQuery );
Note: See TracChangeset for help on using the changeset viewer.