Skip to content

Instantly share code, notes, and snippets.

@isramv
Created March 7, 2019 21:53
Show Gist options
  • Save isramv/80a0b2845397d164c04b943741cce68e to your computer and use it in GitHub Desktop.
Save isramv/80a0b2845397d164c04b943741cce68e to your computer and use it in GitHub Desktop.
css drowpdown navigation on touch enabled devices.
/* eslint-disable */
(function ($) {
Drupal.behaviors.mainNavTouch = {
attach: function (context) {
if (Modernizr.touchevents) {
$('#block-evolve-main-menu > ul.menu > li.expandable > a:not(.ohm-mobile-toggle)', context).on('click', function(event) {
var element = $(this);
var firstTimeout = setTimeout(function() {
element.attr({
blocked: false
})
}, 500);
var secondTimeout = setTimeout(function() {
element.removeAttr('blocked');
}, 3000);
if(element.attr('blocked') !== 'false') {
event.preventDefault();
}
});
}
}
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment