Spaces:
Running
Running
File size: 2,699 Bytes
9105f53 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
// Mobile menu toggle functionality
document.addEventListener('DOMContentLoaded', function() {
const menuButton = document.querySelector('nav button');
const mobileMenu = document.createElement('div');
mobileMenu.className = 'md:hidden fixed inset-0 bg-[#0D0D0D] z-50 flex flex-col items-center justify-center hidden';
mobileMenu.innerHTML = `
<button class="absolute top-8 right-8 text-white">
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
<div class="flex flex-col items-center space-y-12 text-white text-lg">
<a href="#products" class="hover:text-[#FF1069] transition-colors tracking-widest">FRAGRANCES</a>
<a href="#about" class="hover:text-[#FF1069] transition-colors tracking-widest">ABOUT</a>
<a href="#collections" class="hover:text-[#FF1069] transition-colors tracking-widest">COLLECTIONS</a>
<a href="#" class="hover:text-[#FF1069] transition-colors tracking-widest">JOURNAL</a>
</div>
`;
document.body.appendChild(mobileMenu);
menuButton.addEventListener('click', function() {
mobileMenu.classList.remove('hidden');
});
mobileMenu.querySelector('button').addEventListener('click', function() {
mobileMenu.classList.add('hidden');
});
// Close mobile menu when clicking on a link
mobileMenu.querySelectorAll('a').forEach(link => {
link.addEventListener('click', function() {
mobileMenu.classList.add('hidden');
});
});
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Add subtle scroll animations
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('fade-in');
}
});
}, observerOptions);
document.querySelectorAll('section').forEach(section => {
observer.observe(section);
});
});
|