class CustomFooter extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = ` `; // Initialize back to top button this.initializeBackToTop(); // Replace feather icons setTimeout(() => { if (window.feather) { window.feather.replace(); } }, 100); } initializeBackToTop() { const backToTop = this.shadowRoot.getElementById('backToTop'); if (backToTop) { // Show/hide button based on scroll position window.addEventListener('scroll', () => { if (window.pageYOffset > 300) { backToTop.classList.add('visible'); } else { backToTop.classList.remove('visible'); } }); // Scroll to top when clicked backToTop.addEventListener('click', () => { window.scrollTo({ top: 0, behavior: 'smooth' }); }); } } } customElements.define('custom-footer', CustomFooter);