diff --git a/assets/js/hero.js b/assets/js/hero.js index 8831bb8..d81660c 100644 --- a/assets/js/hero.js +++ b/assets/js/hero.js @@ -39,6 +39,20 @@ document.addEventListener("DOMContentLoaded", () => { const heroInput = document.getElementById("hero-input"); const typewriterEl = document.getElementById("typewriter-title"); + // Hero search: open store picker, then redirect to {STORE_URL}/catalogsearch/result/?q=... + const buySearchForm = document.querySelector("#buy-section .hero-search-form"); + if (buySearchForm) { + buySearchForm.addEventListener("submit", (e) => { + e.preventDefault(); + const q = (heroInput?.value || "").trim(); + if (!q) return; + const slug = `catalogsearch/result/?q=${encodeURIComponent(q)}`; + if (typeof window.openStoreModal === "function") { + window.openStoreModal(slug); + } + }); + } + // Multi-stage Typewriter Sequence const typeStrings = [ "Network hardware sourcing made simple",