Skip to content
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.

Commit

Permalink
Revert: touch devices: open submenus on the desktop horizontal menu (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Nov 7, 2019
1 parent 8d9725e commit 92e0a3e
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,37 +523,6 @@ twentytwenty.primaryMenu = {
self = self.parentElement;
}
}

/**
* Toggles `focus` class to allow submenu access on tablets.
*/
( function( menuObj ) {
var touchStartFn, j,
parentLink = menuObj.querySelectorAll( '.primary-menu .menu-item-has-children > a' );

if ( 'ontouchstart' in window ) {
touchStartFn = function( e ) {
var menuItem = this.parentNode;

if ( ! menuItem.classList.contains( 'focus' ) ) {
e.preventDefault();
for ( j = 0; j < menuItem.parentNode.children.length; ++j ) {
if ( menuItem === menuItem.parentNode.children[j] ) {
continue;
}
menuItem.parentNode.children[i].classList.remove( 'focus' );
}
menuItem.classList.add( 'focus' );
} else {
menuItem.classList.remove( 'focus' );
}
};

for ( j = 0; j < parentLink.length; ++j ) {
parentLink[j].addEventListener( 'touchstart', touchStartFn, false );
}
}
}( menu ) );
}
}; // twentytwenty.primaryMenu

Expand Down

0 comments on commit 92e0a3e

Please sign in to comment.