; (function() { var scrollToTopBtn = $('#scroll-to-top'); var sliderContainer = $('#slider-container'); var toggleScrollToTopBtn = function() { if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { sliderContainer.addClass('flex').removeClass('hidden'); } else { sliderContainer.addClass('hidden').removeClass('flex'); } }; window.addEventListener('scroll', function() { toggleScrollToTopBtn(); }); scrollToTopBtn.on('click', function() { window.scrollTo({ top: 0, behavior: 'smooth' }); }); toggleScrollToTopBtn(); })();