Enable link after first click

Requirements:

When I clicked first time on menu item which has dropdown menu, It should show its dropdown and when I clicked on the same menu item second time it will redirect to its own page.
Please consider the situation. Menu item redirect to its own page only when its dropdown are opens

Reference Images:

hello

enter image description here

Reference website link:

Reference website link

Note for referaence website:

1) Please open reference website link on mobile view.
2) Click on about page than Dental Page and than again About page , When you second time clicked on about page It goes to its own page. But on this occasion I want to open its dropdown and again If I clicked About page than it goes to its own page

Currently I am using jQuery bind function and disable link through event.preventDefault() but i didn’t resolve my problem
Here’s my code

jQuery Code:

$(document).ready(function(){
    $(".flexnav li.parent-menu-item > a").bind("click.myclick", function(event) {
        event.preventDefault();
        $(".flexnav li .sub-menu").hide();
        $(this).unbind(".myclick");
        $(this).parents(".flexnav li.parent-menu-item").children(".sub-menu").toggle();
    }); 
});  

Sorry for my language mistakes
Thanks!


Source: wordpress

Leave a Reply