From: Anthony Talarico Date: Thu, 11 Oct 2018 16:28:51 +0000 (-0400) Subject: removing click links for nav items that have no children X-Git-Tag: v1.0.0^2~19 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=1901c3ee1a24c42f2001128161ff6d95d6f30e65;p=WP-Themes%2Flakesideclub.git removing click links for nav items that have no children --- diff --git a/js/app.js b/js/app.js index e16ffb0..fbbcd24 100644 --- a/js/app.js +++ b/js/app.js @@ -48,13 +48,16 @@ $(document).ready(function () { $(window).on("scroll", scrolled); var main_nav_top_level = $('.top-bar-section').children('ul').children('li.menu-item-has-children'); - + var main_nav_top_level_no_children = $('.top-bar-section').children('ul').children('li:not(.menu-item-has-children)'); + main_nav_top_level_no_children.find('> a').on("click", function(event){ + event.preventDefault(); + }); 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.stopPropagation(); event.preventDefault(); } }); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index a32aba1..8c12837 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -39,13 +39,16 @@ $(document).ready(function () { $(window).on("scroll", scrolled); var main_nav_top_level = $('.top-bar-section').children('ul').children('li.menu-item-has-children'); - + var main_nav_top_level_no_children = $('.top-bar-section').children('ul').children('li:not(.menu-item-has-children)'); + main_nav_top_level_no_children.find('> a').on("click", function(event){ + event.preventDefault(); + }); 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.stopPropagation(); event.preventDefault(); } });