|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
|
|
const navLinks = document.querySelectorAll('nav a[href^="#"]'); |
|
|
navLinks.forEach(link => { |
|
|
link.addEventListener('click', function(e) { |
|
|
e.preventDefault(); |
|
|
const targetId = this.getAttribute('href'); |
|
|
const targetSection = document.querySelector(targetId); |
|
|
|
|
|
window.scrollTo({ |
|
|
top: targetSection.offsetTop - 80, |
|
|
behavior: 'smooth' |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const orderBtn = document.getElementById('order-btn'); |
|
|
orderBtn.addEventListener('click', function() { |
|
|
showNotification('Your order will be ready soon!'); |
|
|
document.getElementById('menu').scrollIntoView({ behavior: 'smooth', block: 'start' }); |
|
|
}); |
|
|
|
|
|
|
|
|
function showNotification(message) { |
|
|
|
|
|
let notification = document.querySelector('.notification'); |
|
|
|
|
|
if (!notification) { |
|
|
notification = document.createElement('div'); |
|
|
notification.className = 'notification'; |
|
|
document.body.appendChild(notification); |
|
|
} |
|
|
|
|
|
notification.textContent = message; |
|
|
notification.classList.add('show'); |
|
|
|
|
|
setTimeout(() => { |
|
|
notification.classList.remove('show'); |
|
|
}, 3000); |
|
|
} |
|
|
}); |