jQuery( document ).ready(function() jQuery(.nav-item).each(function(index) jQuery(this).find(.sub-nav).css(left, jQuery(this).position().left); ) ); jQuery( window ).resize(function() jQuery(.nav-item).each(function(index) jQuery(this).find(.sub-nav).css(left, jQuery(this).position().left); ) );
jQuery(#search-form-trigger).on(click, function () var checkSearchModalExists = setInterval(function () // Check if Search Modal exists on the page yet, if not, check again in 100ms if (document.querySelector(#elementor-popup-modal-23380)) // Clear interval so this only runs once clearInterval(checkSearchModalExists); jQuery(.elementor-search-form__input).focus(); var selectInput = document.getElementsByClassName(elementor-search-form__input)[0]; selectInput.setAttribute(id, search-form); selectInput.insertAdjacentHTML(beforebegin,
); // Focus lock code // add all the elements inside modal which you want to make focusable const focusableElements = button, [href], input, select, textarea, [tabindex]:not([tabindex=-1]); const modal = document.querySelector( #elementor-popup-modal-23380); // select the modal by it's id const firstFocusableElement = modal.querySelectorAll(focusableElements)[ 0]; // get first element to be focused inside modal const focusableContent = modal.querySelectorAll(focusableElements); const lastFocusableElement = focusableContent[focusableContent.length - 1]; // get last element to be focused inside modal document.addEventListener(keydown, function (e) let isTabPressed = e.key === Tab || e.keyCode === 9; if (!isTabPressed) if (e.key == Escape) document.getElementById(search-form-trigger).querySelector(a) .focus(); return; if (e.shiftKey) // if shift key pressed for shift + tab combination if (document.activeElement === firstFocusableElement) lastFocusableElement .focus(); // add focus for the last focusable element e.preventDefault(); else // if tab key is pressed if (document.activeElement === lastFocusableElement ) // if focused has reached to last focusable element then focus first focusable element after pressing tab firstFocusableElement .focus(); // add focus for the first focusable element e.preventDefault(); ); , 100); // check if Search Modal is loaded every 100ms ); 

