Created
June 5, 2014 07:27
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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