Webflow - Hyperbound
Sun Feb 23 2025 07:45:03 GMT+0000 (Coordinated Universal Time)
Saved by
@pradeep188
<script>
// auto loading tabs
var Webflow = Webflow || [];
Webflow.push(function () {
// Fix for Safari
if (navigator.userAgent.includes("Safari")) {
document.querySelectorAll(".acc_tab").forEach((t) => (t.focus = function () {
const x = window.scrollX, y = window.scrollY;
const f = () => {
setTimeout(() => window.scrollTo(x, y), 1);
t.removeEventListener("focus", f);
};
t.addEventListener("focus", f);
HTMLElement.prototype.focus.apply(this, arguments);
}));
}
// Start Tabs
function startTabs() {
var tabTimeout;
clearTimeout(tabTimeout);
tabLoop();
// Connect your class names to elements.
function tabLoop() {
tabTimeout = setTimeout(function () {
var $next = $('.acc_tabs-menu').children('.w--current:first').next();
if ($next.length) {
$next.click(); // user click resets timeout
} else {
$('.acc_tab:first').click();
}
}, 5000); // 5 Second Rotation
}
// Reset Loops
$('.acc_tab').click(function () {
clearTimeout(tabTimeout);
tabLoop();
});
}
// Run tabs function
startTabs();
});
</script>
content_copyCOPY
Auto tab switching - Basic
https://hyperbound.design.webflow.com/
Comments