Spaces:
Sleeping
Sleeping
Update app.py
Browse files140 unmodified lines14114214314414514614718 unmodified lines1661671681691701711721731741751761774 unmodified lines182183184185186187140 unmodified lines# JavaScript for managing the pop-upgr.HTML(f"""<div id="popup" style="display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);background-color: white; padding: 20px; border-radius: 10px;box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); z-index: 1000; text-align: center; width: 500px;"><img id="popup-image" src="" alt="" style="width: 100%; height: auto; border-radius: 10px;">18 unmodified linescolor: white; border: none; border-radius: 5px; cursor: pointer;">Close</button></div><script>function showPopup(image, title, description, price) {document.getElementById('popup-image').src = image;document.getElementById('popup-title').textContent = title;document.getElementById('popup-description').textContent = description;document.getElementById('popup-price').textContent = "Price: " + price;// Display the popupdocument.getElementById('popup').style.display = 'block';}4 unmodified linesconst selectedExtras = Array.from(document.querySelectorAll('input[name=extras]:checked')).map(cb => cb.value).join(", ");alert(dishName + " with " + spiceLevel + " spice level and extras: " + selectedExtras + " has been added to the cart!");}</script>""")140 unmodified lines14114214314414514614718 unmodified lines1661671681691701711721731741751761771781791801811821834 unmodified lines188189190191192193194195196197198140 unmodified lines# JavaScript for managing the pop-upgr.HTML(f"""<div id="popup" style="display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);background-color: white; padding: 20px; border-radius: 10px;box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); z-index: 1000; text-align: center; width: 500px;"><img id="popup-image" src="" alt="" style="width: 100%; height: auto; border-radius: 10px;">18 unmodified linescolor: white; border: none; border-radius: 5px; cursor: pointer;">Close</button></div><script>function showPopup(event, (image, title, description, price)) {document.getElementById('popup-image').src = image;document.getElementById('popup-title').textContent = title;document.getElementById('popup-description').textContent = description;document.getElementById('popup-price').textContent = "Price: " + price;// Set the position of the popuppopup.style.left = `${event.pageX + 10}px`; // Add a small offsetpopup.style.top = `${event.pageY + 10}px`; // Add a small offset// Display the popupdocument.getElementById('popup').style.display = 'block';}4 unmodified linesconst selectedExtras = Array.from(document.querySelectorAll('input[name=extras]:checked')).map(cb => cb.value).join(", ");alert(dishName + " with " + spiceLevel + " spice level and extras: " + selectedExtras + " has been added to the cart!");}const menuItems = document.querySelectorAll('.menu-item');menuItems.forEach(item => {item.addEventListener('click', function(event) {showPopup(event, item.getAttribute('data-name'));});});</script>""")
app.py+13-2