startOpacityScroll) {
topElement.style.opacity = 1;
topElement.style.pointerEvents = 'all';
} else {
topElement.style.opacity = 0;
topElement.style.pointerEvents = 'none';
}
const progress = Math.min(scrollTop / totalScrollHeight, 1);
let dashoffset = pathLength * (1 - progress);
if (scrollTop === totalScrollHeight) {
dashoffset = 0;
}
progressPath.style.strokeDashoffset = dashoffset;
}
window.addEventListener('scroll', handleScroll);
topElement.addEventListener('click', () => {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
}
document.addEventListener('DOMContentLoaded', initBackToTop2);
if (Shopify.designMode) {
document.addEventListener('shopify:section:unload', initBackToTop2);
document.addEventListener('shopify:section:load', initBackToTop2);
}