1(function ($) { 2 "use strict"; 3 4 5 jQuery(window).scroll(function () { 6 if (jQuery(this).scrollTop() > 100) { 7 jQuery(".addweb-seo-scrollto-top a").fadeIn(); 8 } else { 9 jQuery(".addweb-seo-scrollto-top a").fadeOut(); 10 } 11 }); 12 jQuery(".addweb-seo-scrollto-top a").click(function () { 13 jQuery("html, body").animate({ scrollTop: 0 }, 600); 14 return false; 15 }); 16 17 // Function to check if an element is in the viewport 18 function isElementInViewport(el) { 19 var rect = el.getBoundingClientRect(); 20 return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth); 21 } 22 23 // Function to start counter animation when element is in viewport 24 function startCounterAnimation() { 25 $(".addweb-seo-number-counter") 26 .not(".counted") 27 .each(function () { 28 if (isElementInViewport(this)) { 29 var $this = $(this); 30 $this 31 .addClass("counted") 32 .prop("Counter", 0) 33 .animate( 34 { 35 Counter: $this.text(), 36 }, 37 { 38 duration: 1000, 39 easing: "swing", 40 step: function (now) { 41 $this.text(Math.ceil(now)); 42 }, 43 } 44 ); 45 } 46 }); 47 } 48 49 // Check if element is in viewport on page load 50 $(document).ready(function () { 51 startCounterAnimation(); 52 53 $('.wp-block-group .is-position-sticky').each(function(index) { 54 $(this).css('top', `${index * 25}px`); 55 }); 56 57 58 const summaryElements = $('.wp-block-details summary'); 59 60 summaryElements.each(function() { 61 $(this).on('click', function() { 62 const parentDetailsBlock = $(this).parent(); 63 64 // Close all other details blocks in the same group 65 const allDetailsBlocks = parentDetailsBlock.parent().find('.wp-block-details'); 66 allDetailsBlocks.each(function() { 67 if ($(this)[0] !== parentDetailsBlock[0]) { 68 $(this).removeAttr('open'); 69 } 70 }); 71 }); 72 }); 73 74 75 // code for on hover tab change mega menu start 76 if ($(window).width() > 781) { 77 $('li.menu-tab.wp-block-navigation-item').each(function() { 78 // Find the <ul> inside the current <li> 79 let $submenu = $(this).find('ul.menu-tab.wp-block-navigation__submenu-container'); 80 $submenu.removeClass('menu-tab wp-block-navigation__submenu-container').addClass('sub-menu'); 81 82 let $innermenu = $(this).find('.sub-menu ul.wp-block-navigation__submenu-container'); 83 $innermenu.addClass('inner-menu'); 84 85 let $tabitem = $(this).find('.sub-menu li.wp-block-navigation-item.has-child'); 86 let $firstTabItem = $tabitem.first(); 87 let $firstTabDesc = $firstTabItem.find('ul.inner-menu'); 88 89 // Add "tabitem-hover" and "tabdesc-hover" to the first tab by default 90 $firstTabItem.addClass('tabitem-hover'); 91 $firstTabDesc.addClass('tabdesc-hover'); 92 93 // Variable to keep track of the last hovered tab 94 let $lastHoveredTab = $firstTabItem; 95 96 // Hover functionality 97 $tabitem.hover( 98 function () { 99 // When hovering over a new tab, remove the classes from the last hovered tab 100 $lastHoveredTab.removeClass("tabitem-hover"); 101 $lastHoveredTab.find('ul.inner-menu').removeClass("tabdesc-hover"); 102 103 // Add classes to the currently hovered tab 104 $(this).addClass("tabitem-hover"); 105 $(this).find('ul.inner-menu').addClass("tabdesc-hover"); 106 107 // Update the last hovered tab reference 108 $lastHoveredTab = $(this); 109 }, 110 function () { 111 // When leaving the tab, do nothing so that the last hovered tab retains the classes 112 } 113 ); 114 115 // Check if the <ul> exists to wrap it with the <div> 116 if ($submenu.length) { 117 // Create a new <div> element with the specified classes
118 const $wrapperDiv = $('<div>', { 119 class: 'menu-subs menu-mega wp-block-navigation__submenu-container' 120 }); 121 122 // Move the <ul> inside the new <div> 123 $submenu.wrap($wrapperDiv); 124 } 125 }); 126 }; 127 128 129 if ($(window).width() < 782) { 130 131 // Initially hide all submenus and inner menus 132 $('.sub-menu1').hide(); 133 $('.inner-menu1').hide(); 134 135 // Click event for the responsive container 136 $('.wp-block-navigation__responsive-container-open').on('click', function(event) { 137 event.stopPropagation(); // Prevent click event from bubbling up 138 // Toggle the open state of the responsive menu 139 $(this).toggleClass('open'); 140 141 // If the menu is being opened, reset all submenus and inner menus 142 if ($(this).hasClass('open')) { 143 $('.sub-menu1').hide(); // Hide all submenus 144 $('.inner-menu1').hide(); // Hide all inner menus 145 } 146 }); 147 148 $('li.menu-tab.wp-block-navigation-item').each(function() { 149 let $submenu = $(this).find('ul.menu-tab.wp-block-navigation__submenu-container'); 150 $submenu.removeClass('menu-tab wp-block-navigation__submenu-container').addClass('sub-menu1'); 151 152 let $innermenu = $submenu.find('ul.wp-block-navigation__submenu-container'); 153 $innermenu.addClass('inner-menu1'); 154 155 // Click event for the main menu tab 156 $(this).on('click', function(event) { 157 event.stopPropagation(); // Prevent click event from bubbling up 158 // Hide all other submenus 159 $('.sub-menu1').not($submenu).hide(); 160 // Toggle the clicked submenu 161 $submenu.toggle(); 162 }); 163 164 // Click event for the inner menu items 165 $submenu.find('> li').on('click', function(event) { 166 event.stopPropagation(); // Prevent click event from bubbling up 167 let $innerMenu = $(this).find('.inner-menu1'); 168 // Hide all other inner menus 169 $('.inner-menu1').not($innerMenu).hide(); 170 // Toggle the clicked inner menu 171 $innerMenu.toggle(); 172 }); 173 }); 174 175 // Click event on the document to close all menus 176 $(document).on('click', function() { 177 $('.sub-menu1').hide(); // Hide all submenus 178 $('.inner-menu1').hide(); // Hide all inner menus 179 $('.wp-block-navigation__responsive-container-open').removeClass('open'); // Remove open class 180 }); 181 182 }; 183 184 // code for on hover tab change mega menu end 185 186 }); 187 188 // Check if element is in viewport on scroll 189 $(window).on("scroll", function () { 190 startCounterAnimation(); 191 }); 192 193 194 195 })(jQuery);
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.