From: Anthony Talarico Date: Mon, 17 Dec 2018 19:07:55 +0000 (-0500) Subject: making topbar menu items not clickable if they have children X-Git-Tag: v1.0.0^2~214 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=a175be36af34333eca59e4850dbcfb06a4047975;p=WP-Themes%2Fuptravel.git making topbar menu items not clickable if they have children --- diff --git a/js/app.js b/js/app.js index 3c73e49..2b3ab42 100644 --- a/js/app.js +++ b/js/app.js @@ -130,7 +130,18 @@ $(document).ready(function () { $("#searchIcon").css("visibility", "visible"); }); - + var main_nav_top_level = $('.top-bar-section').children('ul').children('li.menu-item-has-children'); + + main_nav_top_level.each(function() { + $(this).on("click", function(event){ + var parentId = $(this).attr("id"); + var childId = $(event.target).parent().attr("id") + if( parentId === childId ){ + event.stopPropagation(); + event.preventDefault(); + } + }); + }); });;jQuery(function($){ if($(document).scrollTop() > 0){ diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index cb82c24..34fb917 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -18,5 +18,16 @@ $(document).ready(function () { $("#searchIcon").css("visibility", "visible"); }); - + var main_nav_top_level = $('.top-bar-section').children('ul').children('li.menu-item-has-children'); + + main_nav_top_level.each(function() { + $(this).on("click", function(event){ + var parentId = $(this).attr("id"); + var childId = $(event.target).parent().attr("id") + if( parentId === childId ){ + event.stopPropagation(); + event.preventDefault(); + } + }); + }); }); \ No newline at end of file