PageSourceSearch

https://www.lifestarr.com/hubfs/hub_generated/template_assets/1/19…/1790887598441/template_mega-menu-v2.min.js

js lifestarr.com collected 2026-10-02 15:17:04 UTC 3,702 bytes, 2 lines download raw bytes

1function megaMenu(breakPoint){var winWidth=$(window).width();function getLiFromAnchor($a){return $a.closest("li.hs-menu-depth-1")}function getMenuFromLi($li){return $li.children(".mega-menu").first()}function getAnchorFromLi($li){return $li.children("a.mega").first()}function setAriaForMenu($menu,isOpen){var $a=getAnchorFromLi($menu.closest("li.hs-menu-depth-1"));$a.length&&$a.attr("aria-expanded",isOpen?"true":"false")}function openMenuForLi($li){$(".mega-menu").removeClass("active").each(function(){setAriaForMenu($(this),!1)});var $menu=getMenuFromLi($li);$menu.length&&($menu.addClass("active"),setAriaForMenu($menu,!0))}function closeMenuForLi($li){var $menu=getMenuFromLi($li);$menu.length&&($menu.removeClass("active"),setAriaForMenu($menu,!1))}function getTopAnchors(){return $("li.hs-menu-depth-1 > a.mega")}function moveFocusToSiblingAnchor($currentA,dir){var $anchors=getTopAnchors(),idx=$anchors.index($currentA);if(-1!==idx){var nextIdx=(idx+("next"===dir?1:-1)+$anchors.length)%$anchors.length,$nextA=$anchors.eq(nextIdx);openMenuForLi(getLiFromAnchor($nextA)),$nextA.focus()}}if($("a.mega").attr({"aria-haspopup":"true","aria-expanded":"false"}),winWidth>breakPoint){var numMenus=$(".mega-menu").length;for(let i=1;i<=numMenus;i++){const $drop=$(`.mega-drop-${i}`),$menu=$(`.mega-menu-${i}`);if(!$drop.length)continue;$drop.addClass("loaded").closest("li.hs-menu-depth-1").find("ul.hs-menu-children-wrapper").hide();let $li=$drop.closest("li.hs-menu-depth-1"),$menuCopy=$menu.clone(!0);$menu.remove(),$li.append($menuCopy),$menuCopy=$(`.mega-menu-${i}`),$li.off(".mega"),$menuCopy.off(".mega"),$li.on("mouseenter.mega","a.mega, span.loaded",function(){openMenuForLi($(this).closest("li.hs-menu-depth-1"))}),$li.on("mouseleave.mega",function(e){this.contains(e.relatedTarget)||closeMenuForLi($li)})}$("span.loaded").off("mouseenter.mega").on("mouseenter.mega",function(){openMenuForLi($(this).closest("li.hs-menu-depth-1"))})}$(document).off("focusin.mega","a.mega").on("focusin.mega","a.mega",function(){openMenuForLi(getLiFromAnchor($(this)))}),$(document).off("keydown.mega","a.mega").on("keydown.mega","a.mega",function(e){var $a=$(this),$li=getLiFromAnchor($a),key=e.key;if("Enter"===key||" "===key||"ArrowDown"===key){e.preventDefault(),openMenuForLi($li);var $firstFocusable=getMenuFromLi($li).find('a,button,[tabindex]:not([tabindex="-1"])').filter(":visible").first();$firstFocusable.length&&$firstFocusable.focus()}if("Escape"===key&&closeMenuForLi($li),"ArrowRight"===key&&(e.preventDefault(),moveFocusToSiblingAnchor($a,"next")),"ArrowLeft"===key&&(e.preventDefault(),moveFocusToSiblingAnchor($a,"prev")),"Home"===key){e.preventDefault();var $first=getTopAnchors().first();openMenuForLi(getLiFromAnchor($first)),$first.focus()}if("End"===key){e.preventDefault();var $last=getTopAnchors().last();openMenuForLi(getLiFromAnchor($last)),$last.focus()}}),$(document).off("keydown.mega",".mega-menu").on("keydown.mega",".mega-menu",function(e){var key=e.key,$li=$(this).closest("li.hs-menu-depth-1");if("Escape"===key){closeMenuForLi($li);var $a=getAnchorFromLi($li);$a.length&&$a.focus()}"ArrowRight"!==key&&"ArrowLeft"!==key||(e.preventDefault(),moveFocusToSiblingAnchor(getAnchorFromLi($li),"ArrowRight"===key?"next":"prev"))}),$(document).off("focusout.mega","li.hs-menu-depth-1").on("focusout.mega","li.hs-menu-depth-1",function(){var $li=$(this);setTimeout(function(){(function($li){var active=document.activeElement;return!!active&&($li.has(active).length>0||$li[0]===active)})($li)||closeMenuForLi($li)},10)})}
2//# sourceURL=https://4283891.fs1.hubspotusercontent-na1.net/hubfs/4283891/hub_generated/template_assets/1/192905755035/1790887598441/template_mega-menu-v2.js

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.