(function () { /* ========= 1) CONFIG ========= */ var TAB_MAP = { revolution: '1760967628360-6', freestyle: '1760967628556-5', landing: '1760967628666-4', gymnast: '1760967629393-0' }; // Optional: run only on the stock-sale page // if (!/\/stock-sale\/?$/.test(location.pathname)) return; var SCROLL_OFFSET = 80; // adjust for sticky header height /* ========= 2) HELPERS ========= */ function qs(sel, ctx) { return (ctx || document).querySelector(sel); } function qsa(sel, ctx) { return Array.prototype.slice.call((ctx || document).querySelectorAll(sel)); } function findTabLinkByFixedId(fixedId) { // WPBakery tab links typically use #tab- or # var selector = '.vc_tta-tabs-list a[href="#tab-' + fixedId + '"], ' + '.vc_tta-tabs-list a[href="#' + fixedId + '"]'; return qs(selector); } function getTabsContainerFromLink(link) { return link ? link.closest('.vc_tta') : null; } function scrollToTabs(container) { if (!container) return; var top = container.getBoundingClientRect().top + window.pageYOffset - SCROLL_OFFSET; window.scrollTo({ top: top, behavior: 'smooth' }); } function friendlyToFixed(hash) { // if it's one of our friendly names, map it if (TAB_MAP[hash]) return TAB_MAP[hash]; // if a fixed id was used directly (with or without 'tab-' prefix), normalize it return hash.replace(/^tab-/, ''); } function fixedToFriendly(fixedId) { // reverse lookup for updating the URL hash on click for (var k in TAB_MAP) if (TAB_MAP[k] === fixedId) return k; return null; } /* ========= 3) CORE LOGIC ========= */ function activateTabFromHash() { var raw = window.location.hash.replace('#', ''); if (!raw) return; var fixedId = friendlyToFixed(raw); var link = findTabLinkByFixedId(fixedId); if (link) { // Click the tab link to activate it link.click(); scrollToTabs(getTabsContainerFromLink(link)); } } function attachClickHandlers() { // Keep URL hash in sync when user clicks between tabs qsa('.vc_tta-tabs-list a').forEach(function (a) { a.addEventListener('click', function (e) { // Extract fixed id from href (#tab- or #) var href = (a.getAttribute('href') || '').replace('#', ''); var fixedId = href.replace(/^tab-/, ''); var friendly = fixedToFriendly(fixedId) || fixedId; // fallback to fixed if no friendly if (friendly) { // Update hash without jumping history.replaceState(null, '', '#' + friendly); } }); }); } /* ========= 4) WAIT FOR TABS, THEN INIT ========= */ function waitForTabsAndInit(retries) { retries = retries || 40; // ~2s @ 50ms if (qs('.vc_tta-tabs-list a')) { attachClickHandlers(); activateTabFromHash(); window.addEventListener('hashchange', activateTabFromHash); return; } if (retries > 0) { setTimeout(function () { waitForTabsAndInit(retries - 1); }, 50); } } // Kick off when DOM is ready if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', waitForTabsAndInit); } else { waitForTabsAndInit(); } })();Skip to main content

Barcelona expo

By 30th November 2007No Comments

This week landing snowboard is for BigAirBAG in the Nivalia expo in Barcelona.
For more info [email protected]