From: Anthony Talarico Date: Thu, 11 Oct 2018 16:22:18 +0000 (-0400) Subject: removing click event for nav items that don't have children X-Git-Tag: v1.0.0^2~25 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=1c652327e8cf13677ca33abd13eb25cf3271ec03;p=WP-Themes%2Flakesideclub.git removing click event for nav items that don't have children --- diff --git a/js/app.js b/js/app.js index c526397..d7e2f71 100644 --- a/js/app.js +++ b/js/app.js @@ -38,4 +38,18 @@ $(document).ready(function () { } } $(window).on("scroll", scrolled); + + 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") + console.log(parentId, childId); + if( parentId === childId ){ + event.preventDefault(); + } + }); + + }); }); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 97ef294..0cc8819 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -29,4 +29,18 @@ $(document).ready(function () { } } $(window).on("scroll", scrolled); + + 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") + console.log(parentId, childId); + if( parentId === childId ){ + event.preventDefault(); + } + }); + + }); });