removing click links for nav items that have no children
authorAnthony Talarico <talarico@gaslightmedia.com>
Thu, 11 Oct 2018 16:28:51 +0000 (12:28 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Thu, 11 Oct 2018 17:33:37 +0000 (13:33 -0400)
js/app.js
js/custom/pageSetup.js

index e16ffb0..fbbcd24 100644 (file)
--- 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();
             }
         });
index a32aba1..8c12837 100644 (file)
@@ -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();
             }
         });