{ startWheel(data.labels.data, data.win, data.repeat, data.coupon); }, 50); } else { setTimeout(() => { ignoreWheel(); }, 50); } } } else { $('.fort').css('display', 'block').css('transform', 'translate(0)') } usedWheel = true; }, error: function (xhr, status, error) { console.error('Error', error); } }) }) $('.live-chat-icons__base a').addClass('pulse-active') $('#woot-chat-icon').on('click', function (e) { e.preventDefault(); $('.woot-widget-holder').removeClass('woot--hide') $('.woot-widget-holder').css('bottom', '154px') $('#woot-chat-close').css('display', 'block') $('#woot-chat-icon').css('display', 'none') $.cookie('autoOpenChat', 'disable', { path: '/', domain: 'polbox.tv', secure: true }) }); const hiddenIcons = $(".live-chat-icons__items").not(".live-chat-icons__base"); const toggleContainer = $(".live-chat-icons__base"); const toggleLinks = hiddenIcons.not(".phone-live-chat").not('.wheels').map(function () { return $(this).html(); }).get(); let currentIndex = 0; let isMenuOpen = false; hiddenIcons.css({opacity: 0, transform: "translateY(60px)"}); const toggleInterval = setInterval(() => { if (!isMenuOpen) { currentIndex = (currentIndex + 1) % toggleLinks.length; toggleContainer.html(toggleLinks[currentIndex]); $('.live-chat-icons__base a').addClass('pulse-active') } }, 4000); toggleContainer.on("click", function (e) { e.preventDefault(); $('.live-chat-icons__base a').addClass('pulse-active') isMenuOpen = !hiddenIcons.hasClass("visible"); if (!isMenuOpen) { $('.wheel-icon').fadeIn(300); } else { $('.wheel-icon').fadeOut(300); } hiddenIcons.each(function (index, element) { const $el = $(element); if ($el.hasClass("visible")) { $el.removeClass("visible").animate({opacity: 0, top: "60px"}, { duration: 300, step: function (now, fx) { if (fx.prop === "top") { $(this).css("transform", `translateY(${now}px)`); } }, } ); } else { $('.live-chat-icons__base a').removeClass('pulse-active') $el.addClass("visible").animate( { opacity: 1, top: "0px" }, { duration: 300, step: function (now, fx) { if (fx.prop === "top") { $(this).css("transform", `translateY(${now}px)`); $(this).css("transform", 'scale(0.8)'); } }, } ); } }); }); const checkCondition = () => { if ($(window).width() <= 666 && !$('#cw-widget-holder').hasClass('woot--hide')) { $('.live-chat-close-btn').addClass('close-btn-woot-active'); } else { $('.live-chat-close-btn').removeClass('close-btn-woot-active'); } }; setTimeout(() => { if ($('#cw-widget-holder').hasClass('woot--hide')) { $('.live-chat-close-btn').removeClass('close-btn-woot-active'); } else { checkCondition(); } }, 10); $(window).on('resize', checkCondition); $(window).on('load', checkCondition); $('#woot-chat-icon, #woot-chat-close').on('click', function () { setTimeout(checkCondition, 10); }); $('.live-chat-close-btn').on('click', function (e) { $('#cw-widget-holder').addClass('woot--hide'); $('.live-chat-close-btn').removeClass('close-btn-woot-active'); }) });