class CustomHeader extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
const mobileMenuButton = this.shadowRoot.getElementById('mobile-menu-button');
const mobileMenu = this.shadowRoot.getElementById('mobile-menu');
mobileMenuButton.addEventListener('click', () => {
mobileMenu.classList.toggle('open');
mobileMenuButton.classList.toggle('active');
feather.replace();
});
// Header scroll effect
window.addEventListener('scroll', () => {
if (window.scrollY > 10) {
this.classList.add('scrolled');
} else {
this.classList.remove('scrolled');
}
});
}
}
}
customElements.define('custom-header', CustomHeader);