Auto Toggle Tab Script is triggering the mobile menu to close

Hello everyone,

I used a common script shared by the community to create an auto-rotate tab function in Webflow.

The rotating tabs work great, but when I’m on mobile and have my hamburger menu open, every time the next tab is rotated in the background, it causes a reset and my menu closes on me.

Any ideas what’s going on here. Any help would be appreciated.

Here’s the code snipped I used:

<script defer>
	var Webflow = Webflow || [];
	Webflow.push(function () {
		// Fix for Safari
		if (navigator.userAgent.includes("Safari")) {
  		document.querySelectorAll(".tabs_feature").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
		var tabTimeout;
		clearTimeout(tabTimeout);
		tabLoop();

    // Connect your class names to elements
    function tabLoop() {
			tabTimeout = setTimeout(function() {
				var $next = $('.tabs_vertical').children('.w--current:first').next();

				if($next.length) {
					$next.click();  // user click resets timeout
				} else {
					$('.tabs_feature:first').click();
				}
			}, 5000);  // 5 Second Rotation
    }

    // Reset Loops
    $('.tabs_feature').click(function() {
			clearTimeout(tabTimeout);
			tabLoop();
		});
	});
</script>```