class CustomNavigation extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
// Mobile menu toggle
const menuButton = this.shadowRoot.getElementById('mobile-menu-button');
const mobileMenu = this.shadowRoot.getElementById('mobile-menu');
menuButton.addEventListener('click', () => {
mobileMenu.classList.toggle('open');
feather.replace();
});
// Scroll effect
window.addEventListener('scroll', () => {
const nav = this.shadowRoot.querySelector('nav');
if (window.scrollY > 10) {
nav.classList.add('scrolled');
} else {
nav.classList.remove('scrolled');
}
});
// Initialize feather icons
feather.replace();
}
}
customElements.define('custom-navigation', CustomNavigation);