Fouk

Compra discos de vinilo de Fouk.

Suscríbete a Nuestro Boletín

document.addEventListener("DOMContentLoaded", function () { const toggleWrap = document.getElementById("btn-sidebar"); const toggleBtn = toggleWrap ? (toggleWrap.querySelector(".elementor-button") || toggleWrap) : null; const sidebar = document.querySelector(".m-filtro"); if (!toggleWrap || !sidebar) return; // Ensure accessible attributes on trigger and drawer if (toggleBtn) { toggleBtn.setAttribute("role", "button"); toggleBtn.setAttribute("aria-expanded", "false"); toggleBtn.setAttribute("aria-controls", "bkm-mobile-filter-drawer"); } sidebar.id = "bkm-mobile-filter-drawer"; sidebar.setAttribute("role", "dialog"); sidebar.setAttribute("aria-modal", "true"); sidebar.setAttribute("aria-label", "Filtros de productos"); sidebar.setAttribute("inert", ""); // Inject header with explicit close button inside drawer if not present if (!sidebar.querySelector(".bkm-drawer-header")) { const header = document.createElement("div"); header.className = "bkm-drawer-header"; header.innerHTML = '

Filtrar productos

'; sidebar.insertBefore(header, sidebar.firstChild); } // Inject dimmed backdrop overlay if not present let backdrop = document.querySelector(".bkm-filtro-backdrop"); if (!backdrop) { backdrop = document.createElement("div"); backdrop.className = "bkm-filtro-backdrop"; backdrop.setAttribute("aria-hidden", "true"); document.body.appendChild(backdrop); } const closeBtn = sidebar.querySelector(".bkm-drawer-close"); function openDrawer() { sidebar.classList.add("active"); sidebar.removeAttribute("inert"); backdrop.classList.add("active"); document.body.style.overflow = "hidden"; if (toggleBtn) toggleBtn.setAttribute("aria-expanded", "true"); if (closeBtn) { setTimeout(function () { closeBtn.focus(); }, 50); } } function closeDrawer(returnFocus) { if (!sidebar.classList.contains("active")) return; sidebar.classList.remove("active"); sidebar.setAttribute("inert", ""); backdrop.classList.remove("active"); document.body.style.overflow = ""; if (toggleBtn) { toggleBtn.setAttribute("aria-expanded", "false"); if (returnFocus) toggleBtn.focus(); } } toggleWrap.addEventListener("click", function (e) { e.preventDefault(); e.stopPropagation(); if (sidebar.classList.contains("active")) { closeDrawer(true); } else { openDrawer(); } }); if (closeBtn) { closeBtn.addEventListener("click", function (e) { e.preventDefault(); e.stopPropagation(); closeDrawer(true); }); } backdrop.addEventListener("click", function () { closeDrawer(false); }); document.addEventListener("keydown", function (e) { if (e.key === "Escape" && sidebar.classList.contains("active")) { closeDrawer(true); } }); });