Help me to create a custom auto chnaging tab start when scroll into view :)

I found this code but it’s keep changing all the time

<script>
    var Webflow = Webflow || [];
    Webflow.push(function () {
      // DOMready has fired
      // May now use jQuery and Webflow api

// start everything
      var tabTimeout;
      clearTimeout(tabTimeout);
      tabLoop();

    // Cycle through all tabs. Match class names
    function tabLoop() {
        tabTimeout = setTimeout(function() {
            var $next = $('.tabs-menu.auto').children('.w--current:first').next();

            if($next.length) {
                $next.click();  // user click resets timeout
            } else {
                $('.tab-link.auto:nth-child(2)').click();
            }
        }, 8000);  // 8 second tab loop (change this)
    }

    // Reset loop if a tab is clicked
    $('.tab-link.auto').click(function() {
        clearTimeout(tabTimeout);
        tabLoop();
        });
    });
</script>