Changed around line 1
+ document.addEventListener('DOMContentLoaded', function() {
+ // Search functionality
+ const searchInput = document.getElementById('searchInput');
+ searchInput.addEventListener('input', function(e) {
+ // Implement search logic here
+ console.log('Searching for:', e.target.value);
+ });
+
+ // Cart functionality
+ let cartItems = [];
+ const cartButton = document.getElementById('cartButton');
+
+ function updateCart() {
+ cartButton.textContent = `Cart (${cartItems.length})`;
+ }
+
+ // Add click event listeners to all "Order Now" buttons
+ document.querySelectorAll('.restaurant-card button').forEach(button => {
+ button.addEventListener('click', function(e) {
+ const restaurant = e.target.closest('.restaurant-card');
+ const restaurantName = restaurant.querySelector('h3').textContent;
+
+ cartItems.push({
+ name: restaurantName,
+ time: Date.now()
+ });
+
+ updateCart();
+
+ // Show confirmation animation
+ const confirmation = document.createElement('div');
+ confirmation.textContent = 'Added to cart!';
+ confirmation.style.position = 'fixed';
+ confirmation.style.bottom = '20px';
+ confirmation.style.right = '20px';
+ confirmation.style.backgroundColor = '#4CAF50';
+ confirmation.style.color = 'white';
+ confirmation.style.padding = '1rem';
+ confirmation.style.borderRadius = '5px';
+ confirmation.style.animation = 'slideIn 0.3s ease-out';
+
+ document.body.appendChild(confirmation);
+
+ setTimeout(() => {
+ confirmation.remove();
+ }, 2000);
+ });
+ });
+
+ // Smooth scroll for navigation links
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
+ anchor.addEventListener('click', function (e) {
+ e.preventDefault();
+ document.querySelector(this.getAttribute('href')).scrollIntoView({
+ behavior: 'smooth'
+ });
+ });
+ });
+
+ // Add some animation to the process steps
+ const observer = new IntersectionObserver((entries) => {
+ entries.forEach(entry => {
+ if (entry.isIntersecting) {
+ entry.target.style.opacity = 1;
+ entry.target.style.transform = 'translateY(0)';
+ }
+ });
+ });
+
+ document.querySelectorAll('.step').forEach(step => {
+ step.style.opacity = 0;
+ step.style.transform = 'translateY(20px)';
+ step.style.transition = 'all 0.5s ease-out';
+ observer.observe(step);
+ });
+ });
+
+ // Add this CSS animation to the stylesheet
+ const style = document.createElement('style');
+ style.textContent = `
+ @keyframes slideIn {
+ from {
+ transform: translateX(100%);
+ opacity: 0;
+ }
+ to {
+ transform: translateX(0);
+ opacity: 1;
+ }
+ }
+ `;
+ document.head.appendChild(style);