Community forum for knowledge and support

Updated 3 months ago

Inconsistent Auto-changing Tabs in Webflow Project

At a glance

A community member is using the Header 103 component in a Webflow project, but is experiencing an issue where the tabs do not consistently auto-change after a few seconds as the progress bar fills up. The issue seems to work fine in a private browser, but not consistently on the live site. The community member, coming from a design background, is unsure how to troubleshoot and fix this issue.

In the comments, another community member shares the same issue, noting that it happens on mobile Chrome but not on Safari. When they click on a tab, it starts working, but after reloading the page and not clicking, it stops working again.

A third community member provides a code snippet that they changed using ChatGPT, which they claim has resolved the issue for them. The code involves setting up a tab loop that automatically changes the active tab after a 6-second delay, with some additional checks to ensure the navbar is closed and enough time has elapsed since the last user interaction.

There is no explicitly marked answer in the comments.

Useful resources

Hi everyone,
I'm using Header 103 (preview link) in a Webflow project for a client (live site). However, I'm experiencing an issue where the tabs should auto-change after a few seconds as the progress bar fills up—but this doesn't always happen consistently.
What's strange is that it seems to work fine in a private browser, so I'm unsure what might be causing the inconsistency. Since I come from a design background and don't have a strong coding knowledge, I’m not entirely sure how to troubleshoot or fix this.
If anyone has insights or can point me in the right direction, I’d really appreciate it!
Thanks in advance!

R
C
3 comments

Having the same issue, happens on mobile on Chrome for me, on Safari the auto change works fine. When I click on one it starts working, but after reloading the page and not clicking, it doesn't work.

changed the code with chatgpt to this, it works now for me:

<script><br /> var Webflow = Webflow || [];<br /> Webflow.push(function() {<br /> var tabTimeout;<br /> var lastTabClickTime = 0;<br /><br /> $(document).ready(function() {<br /> clearTimeout(tabTimeout); // Clear any previous timeouts<br /><br /> // Ensure the first tab is active if none is set as "current"<br /> if (!$('.header103_tab-link.w--current').length) {<br /> $('.header103_tab-link:first').addClass('w--current'); // Add 'current' class to the first tab<br /> }<br /><br /> tabLoop(); // Start the tab loop<br /><br /> // Add click listener to tab links<br /> $('.header103_tab-link').click(function() {<br /> lastTabClickTime = Date.now();<br /> clearTimeout(tabTimeout);<br /> tabTimeout = setTimeout(tabLoop, 6000); // Restart loop after interaction<br /> });<br /> });<br /><br /> function tabLoop() {<br /> tabTimeout = setTimeout(function() {<br /> // Ensure navbar is closed or tabs menu exists, and enough time has elapsed since the last interaction<br /> if (($('.w-nav-menu').length === 0 || !$('.w-nav-button').hasClass('w--open')) &&<br /> ($('.header103_tabs-menu').length && Date.now() - lastTabClickTime >= 6000)) {<br /> var $next = $('.header103_tabs-menu').children('.w--current:first').next();<br /><br /> if ($next.length) {<br /> $next.click();<br /> } else {<br /> $('.header103_tab-link:first').click();<br /> }<br /> }<br /><br /> // Recursively call tabLoop<br /> tabLoop();<br /> }, 6000); // 6-second delay<br /> }<br /> });<br /></script>

Add a reply
Sign up and join the conversation on Slack