I am working on a mobile menu that is designed to slide out when clicked.
Currently, the parent pages are displayed by default. I want to implement functionality where if a parent page has child pages, clicking on it will slide down the sub menu. If clicked again, it should navigate to the parent page. However, if the parent page does not have any child pages, it should directly link through.
I have written some code for this purpose, but I suspect there may be a few bugs in it. Any assistance would be greatly appreciated :)
if($(".mob-navigation > ul > li > a").next(".sub-menu").length) {
$(this).one("click", true);
} else {
$(this).one("click", true);
}