]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-content/themes/twentytwelve/js/navigation.js
WordPress 4.0-scripts
[autoinstalls/wordpress.git] / wp-content / themes / twentytwelve / js / navigation.js
index 2c3214108e8d4ac5e5beb109be18081a73970a9e..34a640246e817c2f61d9605e6ba6366a11dba62a 100644 (file)
@@ -8,7 +8,7 @@
                return;
        }
 
-       button = nav.getElementsByTagName( 'h3' )[0];
+       button = nav.getElementsByTagName( 'button' )[0];
        menu   = nav.getElementsByTagName( 'ul' )[0];
        if ( ! button ) {
                return;
        $( '.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 );