From: Laury GvR Date: Wed, 29 Mar 2017 17:11:24 +0000 (-0400) Subject: Made navigation items clickable if they have no children, like on Capstone, rather... X-Git-Tag: v1.0.0^2~34 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=a573fc56865f7f9106f6eb38f5a0c065e2dba284;p=WP-Themes%2Fcharlevoixlibrary.git Made navigation items clickable if they have no children, like on Capstone, rather than never being clickable. --- diff --git a/js/app.js b/js/app.js index 881257b..8f05218 100644 --- a/js/app.js +++ b/js/app.js @@ -33,20 +33,33 @@ $(document).ready(function () { var page      = $('body'),        dropdown  = page.find( $('ul#menu-top-main')),        nav_links = page.find( $(dropdown).children('li').children('a') ); - nav_links.each(function(){ - $(this).on('click', function(e){ - e.preventDefault(); - return false; - }); - }); - nav_links.each(function(){ - $(this).hover( - function(){ - $(this).css('cursor', 'default'); - },function(){ - } - ); + + var topbar_menu_items = page.find( $(dropdown).children('li') ); + var offcanvas_menu_items = page.find(".left-off-canvas-list > ul").children('li'); + + // disable the links for top nav items that have subpages + topbar_menu_items.each( function () { + if ( $(this).hasClass("menu-item-has-children") ){ + $(this).css('cursor','default'); + $(this).children("a").each ( function() { + $(this).css('cursor', 'default'); + }); + $(this).children("a").on('click', function(e){ + e.preventDefault(); + + }); + } + }); + + // disable the links for off canvas nav items that have subpages + offcanvas_menu_items.each( function () { + if ( $(this).hasClass("menu-item-has-children") ){ + $(this).css('cursor','default'); + $(this).children("a").on('click', function(e){ + e.preventDefault(); + }); + } }); var event_feed = $("#feed"); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 19a1e4b..e64fe54 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -24,20 +24,33 @@ $(document).ready(function () { var page      = $('body'),        dropdown  = page.find( $('ul#menu-top-main')),        nav_links = page.find( $(dropdown).children('li').children('a') ); - nav_links.each(function(){ - $(this).on('click', function(e){ - e.preventDefault(); - return false; - }); - }); - nav_links.each(function(){ - $(this).hover( - function(){ - $(this).css('cursor', 'default'); - },function(){ - } - ); + + var topbar_menu_items = page.find( $(dropdown).children('li') ); + var offcanvas_menu_items = page.find(".left-off-canvas-list > ul").children('li'); + + // disable the links for top nav items that have subpages + topbar_menu_items.each( function () { + if ( $(this).hasClass("menu-item-has-children") ){ + $(this).css('cursor','default'); + $(this).children("a").each ( function() { + $(this).css('cursor', 'default'); + }); + $(this).children("a").on('click', function(e){ + e.preventDefault(); + + }); + } + }); + + // disable the links for off canvas nav items that have subpages + offcanvas_menu_items.each( function () { + if ( $(this).hasClass("menu-item-has-children") ){ + $(this).css('cursor','default'); + $(this).children("a").on('click', function(e){ + e.preventDefault(); + }); + } }); var event_feed = $("#feed");