Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -133,29 +133,24 @@ modal_and_cart_js = """
|
|
133 |
alert("You cannot add more items after finalizing your order.");
|
134 |
return;
|
135 |
}
|
136 |
-
|
137 |
const modal = document.getElementById('modal');
|
138 |
-
modal.style.display = 'block';
|
139 |
modal.style.position = 'fixed';
|
140 |
-
|
141 |
-
// Reduce modal height for better display
|
142 |
-
modal.style.height = '50%'; // Adjust height to 50% of the viewport
|
143 |
-
modal.style.overflowY = 'auto'; // Add scrolling if content overflows
|
144 |
-
|
145 |
if (window.innerWidth <= 768) {
|
146 |
// Mobile: Use touch Y position
|
147 |
modal.style.width = '90%';
|
148 |
-
modal.style.top = `${event.touches ? event.touches[0].screenY : event.clientY
|
149 |
} else {
|
150 |
-
// Laptop: Use mouse Y position
|
151 |
modal.style.width = '30%';
|
152 |
-
const adjustedY = event.clientY
|
153 |
modal.style.top = `${adjustedY}px`;
|
154 |
}
|
155 |
|
156 |
modal.style.left = '50%';
|
157 |
-
modal.style.transform = 'translate(-50%,
|
158 |
-
|
159 |
// Set modal content
|
160 |
document.getElementById('modal-image').src = image;
|
161 |
document.getElementById('modal-name').innerText = name;
|
@@ -166,9 +161,10 @@ modal_and_cart_js = """
|
|
166 |
const extrasInputs = document.querySelectorAll('input[name="biryani-extra"]');
|
167 |
extrasInputs.forEach(input => input.checked = false);
|
168 |
document.getElementById('quantity').value = 1;
|
169 |
-
|
170 |
}
|
171 |
|
|
|
172 |
function closeModal() {
|
173 |
document.getElementById('modal').style.display = 'none';
|
174 |
}
|
|
|
133 |
alert("You cannot add more items after finalizing your order.");
|
134 |
return;
|
135 |
}
|
|
|
136 |
const modal = document.getElementById('modal');
|
137 |
+
modal.style.display = 'block';
|
138 |
modal.style.position = 'fixed';
|
139 |
+
|
|
|
|
|
|
|
|
|
140 |
if (window.innerWidth <= 768) {
|
141 |
// Mobile: Use touch Y position
|
142 |
modal.style.width = '90%';
|
143 |
+
modal.style.top = `${event.touches ? event.touches[0].screenY : event.clientY}px`;
|
144 |
} else {
|
145 |
+
// Laptop: Use mouse Y position + 7% of the screen height
|
146 |
modal.style.width = '30%';
|
147 |
+
const adjustedY = event.clientY + (window.innerHeight * 0.01);
|
148 |
modal.style.top = `${adjustedY}px`;
|
149 |
}
|
150 |
|
151 |
modal.style.left = '50%';
|
152 |
+
modal.style.transform = 'translate(-50%, -50%)';
|
153 |
+
|
154 |
// Set modal content
|
155 |
document.getElementById('modal-image').src = image;
|
156 |
document.getElementById('modal-name').innerText = name;
|
|
|
161 |
const extrasInputs = document.querySelectorAll('input[name="biryani-extra"]');
|
162 |
extrasInputs.forEach(input => input.checked = false);
|
163 |
document.getElementById('quantity').value = 1;
|
164 |
+
document.getElementById('special-instructions').value = '';
|
165 |
}
|
166 |
|
167 |
+
|
168 |
function closeModal() {
|
169 |
document.getElementById('modal').style.display = 'none';
|
170 |
}
|