Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -163,7 +163,7 @@ button {
|
|
163 |
"Veg Manchurian": 12
|
164 |
};
|
165 |
let finalized = false;
|
166 |
-
function openModal(name, image, description, price
|
167 |
if (finalized) {
|
168 |
alert("You cannot add more items after finalizing your order.");
|
169 |
return;
|
@@ -171,35 +171,24 @@ button {
|
|
171 |
const modal = document.getElementById('modal');
|
172 |
modal.style.display = 'block';
|
173 |
modal.style.position = 'fixed';
|
174 |
-
|
175 |
if (window.innerWidth <= 768) {
|
176 |
-
// Mobile: Use touch Y position
|
177 |
modal.style.width = '90%';
|
178 |
modal.style.top = `${event.touches ? event.touches[0].screenY : event.clientY}px`;
|
179 |
} else {
|
180 |
-
// Laptop: Use mouse Y position + 7% of the screen height
|
181 |
modal.style.width = '30%';
|
182 |
-
|
183 |
-
modal.style.top = `${adjustedY}px`;
|
184 |
}
|
185 |
-
|
186 |
modal.style.left = '50%';
|
187 |
modal.style.transform = 'translate(-50%, -50%)';
|
188 |
-
|
189 |
-
// Set modal content
|
190 |
document.getElementById('modal-image').src = image;
|
191 |
document.getElementById('modal-name').innerText = name;
|
192 |
document.getElementById('modal-description').innerText = description;
|
193 |
document.getElementById('modal-price').innerText = price;
|
194 |
-
|
195 |
-
// Reset inputs
|
196 |
const extrasInputs = document.querySelectorAll('input[name="biryani-extra"]');
|
197 |
extrasInputs.forEach(input => input.checked = false);
|
198 |
document.getElementById('quantity').value = 1;
|
199 |
-
|
200 |
}
|
201 |
-
|
202 |
-
|
203 |
function closeModal() {
|
204 |
document.getElementById('modal').style.display = 'none';
|
205 |
}
|
|
|
163 |
"Veg Manchurian": 12
|
164 |
};
|
165 |
let finalized = false;
|
166 |
+
function openModal(name, image, description, price) {
|
167 |
if (finalized) {
|
168 |
alert("You cannot add more items after finalizing your order.");
|
169 |
return;
|
|
|
171 |
const modal = document.getElementById('modal');
|
172 |
modal.style.display = 'block';
|
173 |
modal.style.position = 'fixed';
|
|
|
174 |
if (window.innerWidth <= 768) {
|
|
|
175 |
modal.style.width = '90%';
|
176 |
modal.style.top = `${event.touches ? event.touches[0].screenY : event.clientY}px`;
|
177 |
} else {
|
|
|
178 |
modal.style.width = '30%';
|
179 |
+
modal.style.top = `${event.clientY}px`;// Use mouse Y position for laptop
|
|
|
180 |
}
|
|
|
181 |
modal.style.left = '50%';
|
182 |
modal.style.transform = 'translate(-50%, -50%)';
|
|
|
|
|
183 |
document.getElementById('modal-image').src = image;
|
184 |
document.getElementById('modal-name').innerText = name;
|
185 |
document.getElementById('modal-description').innerText = description;
|
186 |
document.getElementById('modal-price').innerText = price;
|
|
|
|
|
187 |
const extrasInputs = document.querySelectorAll('input[name="biryani-extra"]');
|
188 |
extrasInputs.forEach(input => input.checked = false);
|
189 |
document.getElementById('quantity').value = 1;
|
190 |
+
document.getElementById('special-instructions').value = '';
|
191 |
}
|
|
|
|
|
192 |
function closeModal() {
|
193 |
document.getElementById('modal').style.display = 'none';
|
194 |
}
|