Archive for December 6th, 2021

☎ Call Now: 713-660-6000
document.addEventListener("DOMContentLoaded", function () { if (window.innerWidth > 767) return; const header = document.querySelector(".header-lower"); if (!header) return; const spacer = document.createElement("div"); spacer.className = "mobile-header-spacer"; let originalTop = header.getBoundingClientRect().top + window.scrollY; let isFixed = false; function updateHeader() { if (window.innerWidth > 767) return; const scrollPosition = window.scrollY; if (scrollPosition >= originalTop && !isFixed) { spacer.style.height = header.offsetHeight + "px"; header.parentNode.insertBefore(spacer, header); document.body.style.setProperty( "--mobile-sticky-top", document.body.classList.contains("admin-bar") ? "46px" : "0px" ); header.classList.add("mobile-fixed-active"); isFixed = true; } if (scrollPosition < originalTop && isFixed) { header.classList.remove("mobile-fixed-active"); spacer.remove(); isFixed = false; } } window.addEventListener("scroll", updateHeader, { passive: true }); window.addEventListener("resize", function () { if (!isFixed) { originalTop = header.getBoundingClientRect().top + window.scrollY; } updateHeader(); }); updateHeader(); });