linsa11's picture
Create an event conference website with hero countdown timer, speaker lineup with bios, schedule/agenda tabs, venue information with map, ticket tiers and pricing, sponsors logos grid, past event highlights, and registration form.
73f4f81 verified
class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
.navbar {
transition: all 0.3s ease;
}
.navbar.scrolled {
background-color: white;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.mobile-menu {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease;
}
.mobile-menu.open {
max-height: 500px;
}
@media (min-width: 768px) {
.mobile-menu {
max-height: none !important;
}
}
</style>
<nav class="navbar fixed w-full z-50 bg-transparent text-white">
<div class="container mx-auto px-6 py-4">
<div class="flex justify-between items-center">
<a href="#" class="text-2xl font-bold">TechFusion<span class="text-blue-300">2024</span></a>
<!-- Desktop Menu -->
<div class="hidden md:flex space-x-8">
<a href="#speakers" class="hover:text-blue-300 transition">Speakers</a>
<a href="#schedule" class="hover:text-blue-300 transition">Schedule</a>
<a href="#venue" class="hover:text-blue-300 transition">Venue</a>
<a href="#pricing" class="hover:text-blue-300 transition">Pricing</a>
<a href="#register" class="bg-white text-blue-600 px-4 py-2 rounded hover:bg-gray-100 transition">Register</a>
</div>
<!-- Mobile Menu Button -->
<button class="md:hidden focus:outline-none menu-toggle">
<i data-feather="menu"></i>
</button>
</div>
<!-- Mobile Menu -->
<div class="mobile-menu md:hidden bg-white text-gray-800 rounded-lg mt-2">
<div class="px-2 pt-2 pb-4 space-y-2">
<a href="#speakers" class="block px-3 py-2 rounded hover:bg-gray-100">Speakers</a>
<a href="#schedule" class="block px-3 py-2 rounded hover:bg-gray-100">Schedule</a>
<a href="#venue" class="block px-3 py-2 rounded hover:bg-gray-100">Venue</a>
<a href="#pricing" class="block px-3 py-2 rounded hover:bg-gray-100">Pricing</a>
<a href="#register" class="block px-3 py-2 rounded bg-blue-600 text-white hover:bg-blue-700">Register</a>
</div>
</div>
</div>
</nav>
`;
// Add scroll event listener for navbar effect
window.addEventListener('scroll', () => {
const navbar = this.shadowRoot.querySelector('.navbar');
if (window.scrollY > 50) {
navbar.classList.add('scrolled', 'text-gray-800');
navbar.classList.remove('text-white');
} else {
navbar.classList.remove('scrolled', 'text-gray-800');
navbar.classList.add('text-white');
}
});
// Mobile menu toggle
const menuToggle = this.shadowRoot.querySelector('.menu-toggle');
const mobileMenu = this.shadowRoot.querySelector('.mobile-menu');
menuToggle.addEventListener('click', () => {
mobileMenu.classList.toggle('open');
});
}
}
customElements.define('custom-navbar', CustomNavbar);