From 975fdecff0c906c0d62a13c87e8043d72434e382 Mon Sep 17 00:00:00 2001 From: Mark Woodard Date: Mon, 16 Dec 2024 00:25:52 -0600 Subject: [PATCH] fix for automaticscrollspy offset for navigations outside of headers --- includes/assets/js/kb-navigation-block.min.js | 2 +- src/assets/js/kb-navigation-block.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/assets/js/kb-navigation-block.min.js b/includes/assets/js/kb-navigation-block.min.js index dc73c1ae9..f8425caa2 100644 --- a/includes/assets/js/kb-navigation-block.min.js +++ b/includes/assets/js/kb-navigation-block.min.js @@ -1 +1 @@ -(function(){const a=function(a){if(a instanceof HTMLElement){var b=a.getBoundingClientRect();return{top:b.top+window.pageYOffset,left:b.left+window.pageXOffset,right:b.right+window.pageXOffset}}return{top:null,left:null,right:null}},b=function(a,c=null,d=!1){const e=a.querySelector(".kb-nav-dropdown-toggle-btn"),f=a.querySelector("ul.sub-menu");let g=a.classList.contains("menu-item--toggled-on");if(void 0!==c&&"boolean"==typeof c&&(g=!c),e.setAttribute("aria-expanded",(!g).toString()),g){setTimeout(function(){a.classList.remove("menu-item--toggled-on"),f.classList.remove("toggle-show")},5);var h=a.querySelectorAll(".menu-item--toggled-on");for(let a=0;a{c.contains(a.target)||b(c,!1)})})},e=function(a){const c=a.querySelectorAll(".kb-navigation .sub-menu");if(c.length)for(let d=0;d .kb-link-wrap > a").addEventListener("click",function(f){f.preventDefault(),b(c[d].parentNode,null,a.classList.contains("is-vertical"))}),c[d].parentNode.addEventListener("mouseleave",function(c){a.classList.contains("is-vertical")||c.target.classList.contains("kb-nav-link-sub-click")||b(c.target,!1)}),c[d].parentNode.querySelector("a").addEventListener("focus",function(f){if(!a.classList.contains("is-vertical")){var e=f.target.parentNode.parentNode.querySelectorAll("li.menu-item--toggled-on");for(let a=0;awindow.innerWidth&&768<=window.innerWidth?d.classList.contains("navigation-tablet-orientation-vertical")&&(b=!0):768>window.innerWidth&&d.classList.contains("navigation-mobile-orientation-vertical")&&(b=!0),b?(d.classList.remove("is-horizontal"),d.classList.add("is-vertical")):(d.classList.remove("is-vertical"),d.classList.add("is-horizontal"))}},g=function(){var a=null;a=1024 ul.sub-menu"):768 ul.sub-menu"):document.querySelectorAll(".wp-block-kadence-navigation.navigation-mobile-orientation-horizontal .kb-menu-mega-width-mobile-full > ul.sub-menu");for(let c=0;c ul.sub-menu"):768 ul.sub-menu"):document.querySelectorAll(".wp-block-kadence-navigation.navigation-mobile-orientation-horizontal .kb-menu-mega-width-mobile-content > ul.sub-menu"),a?.length)for(let g=0;g{clearTimeout(b),b=setTimeout(()=>{f(a)},200)}),f(a),d()})(),function(){var a=document.querySelectorAll(".wp-block-kadence-navigation .kb-menu-mega-width-full > ul.sub-menu");if(!a.length)return;let b;window.addEventListener("resize",()=>{clearTimeout(b),b=setTimeout(()=>{g()},200)}),g()}(),function(){var a=document.querySelectorAll(".wp-block-kadence-navigation .kb-menu-mega-width-content > ul.sub-menu");if(!a.length)return;let b;window.addEventListener("resize",()=>{clearTimeout(b),b=setTimeout(()=>{h()},200)}),h()}(),function(){var a=document.querySelectorAll(".kb-off-canvas-inner .wp-block-kadence-navigation .menu-item-has-children");if(a.length)for(let d=0;d{c.contains(a.target)||b(c,!1)})})},e=function(a){const c=a.querySelectorAll(".kb-navigation .sub-menu");if(c.length)for(let d=0;d .kb-link-wrap > a").addEventListener("click",function(f){f.preventDefault(),b(c[d].parentNode,null,a.classList.contains("is-vertical"))}),c[d].parentNode.addEventListener("mouseleave",function(c){a.classList.contains("is-vertical")||c.target.classList.contains("kb-nav-link-sub-click")||b(c.target,!1)}),c[d].parentNode.querySelector("a").addEventListener("focus",function(f){if(!a.classList.contains("is-vertical")){var e=f.target.parentNode.parentNode.querySelectorAll("li.menu-item--toggled-on");for(let a=0;awindow.innerWidth&&768<=window.innerWidth?d.classList.contains("navigation-tablet-orientation-vertical")&&(b=!0):768>window.innerWidth&&d.classList.contains("navigation-mobile-orientation-vertical")&&(b=!0),b?(d.classList.remove("is-horizontal"),d.classList.add("is-vertical")):(d.classList.remove("is-vertical"),d.classList.add("is-horizontal"))}},g=function(){var a=null;a=1024 ul.sub-menu"):768 ul.sub-menu"):document.querySelectorAll(".wp-block-kadence-navigation.navigation-mobile-orientation-horizontal .kb-menu-mega-width-mobile-full > ul.sub-menu");for(let c=0;c ul.sub-menu"):768 ul.sub-menu"):document.querySelectorAll(".wp-block-kadence-navigation.navigation-mobile-orientation-horizontal .kb-menu-mega-width-mobile-content > ul.sub-menu"),a?.length)for(let g=0;g{clearTimeout(b),b=setTimeout(()=>{f(a)},200)}),f(a),d()})(),function(){var a=document.querySelectorAll(".wp-block-kadence-navigation .kb-menu-mega-width-full > ul.sub-menu");if(!a.length)return;let b;window.addEventListener("resize",()=>{clearTimeout(b),b=setTimeout(()=>{g()},200)}),g()}(),function(){var a=document.querySelectorAll(".wp-block-kadence-navigation .kb-menu-mega-width-content > ul.sub-menu");if(!a.length)return;let b;window.addEventListener("resize",()=>{clearTimeout(b),b=setTimeout(()=>{h()},200)}),h()}(),function(){var a=document.querySelectorAll(".kb-off-canvas-inner .wp-block-kadence-navigation .menu-item-has-children");if(a.length)for(let d=0;d