(function () { var $tabItems = $(".hr-tab-item"); var $tabPanels = $(".hr-tab-panel"); var currentIndex = 0; var timer = null; var interval = 5000; function switchTab(index, immediate) { if (index === currentIndex) return; $tabItems.removeClass("active"); $tabItems.eq(index).addClass("active"); $tabPanels.removeClass("active"); $tabPanels.eq(index).addClass("active"); currentIndex = index; } function startAutoSwitch() { if (timer) return; timer = setInterval(function () { var nextIndex = (currentIndex + 1) % $tabItems.length; switchTab(nextIndex, false); }, interval); } function stopAutoSwitch() { clearInterval(timer); timer = null; } $tabItems.each(function (index) { $(this).on("mouseenter", function () { stopAutoSwitch(); switchTab(index, true); }); $(this).on("mouseleave", function () { startAutoSwitch(); }); }); startAutoSwitch(); })(); (function () { var $industryCards = $(".industry-card"); $industryCards.on("mouseenter", function () { $industryCards.removeClass("active"); $(this).addClass("active"); }); })();