I am trying to have menu items click to open sub items and then double click to follow through to the link. Have tried a variety of different approaches but for some reason nothing's happening when double clicked.
$( ".site-head .section-menu .mobile-sub-menu ul li .first-a" ).on('click', function(event) {
$( ".sub-items" ).addClass('hiddenMenu');
$(this).parent().find('.sub-items').removeClass('hiddenMenu');
event.preventDefault();
});
$(document).on('dblclick', '.first-a', function() {
console.log("event fired");
window.location.replace($(this).attr("href"));
});
Any suggestions on what I'm doing wrong?
Edit: the standard solution that has been suggested doesn't work in this situation. The double click should direct to link and the first should prevent going to the link and execute some other function...