File size: 1,495 Bytes
687017a |
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 |
document.addEventListener('DOMContentLoaded', function() {
// Smooth scrolling for navigation links
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'
});
});
});
// Order button functionality
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' });
});
// Notification system
function showNotification(message) {
// Check if notification already exists
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);
}
}); |