From 1c652327e8cf13677ca33abd13eb25cf3271ec03 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Thu, 11 Oct 2018 12:22:18 -0400 Subject: [PATCH] removing click event for nav items that don't have children --- js/app.js | 14 ++++++++++++++ js/custom/pageSetup.js | 14 ++++++++++++++ 2 files changed, 28 insertions(+) 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(); + } + }); + + }); }); -- 2.17.1