Skip to content

Instantly share code, notes, and snippets.

@woombo
Created June 5, 2014 07:27
Show Gist options
  • Save woombo/b95c3133909d87b9efc5 to your computer and use it in GitHub Desktop.
Save woombo/b95c3133909d87b9efc5 to your computer and use it in GitHub Desktop.
Allow users on mobile devices to click through menu items, on menu item is touched a class is added assuring the next click will be allowed to perform its behaviour.
jQuery(document).ready(function($){
/**
* Allow users on mobile devices to click through menu items, on menu item is touched
* a class is added assuring the next click will be allowed to perform its behaviour.
*/
$('#menu-fsa-navigation li.menu-item-has-children > a').on({ 'touchstart' : function(e){
var $this = $(this),
next = $this.next('ul.sub-menu');
if (next.length) {
if (!next.hasClass('clicked')) {
e.preventDefault();
next.addClass('clicked');
}
}
}});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment