Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -96,12 +96,18 @@ extras = [
|
|
| 96 |
popup_js = """
|
| 97 |
<script>
|
| 98 |
function showPopup(event, name, description, price) {
|
|
|
|
| 99 |
const popup = document.getElementById("custom-popup");
|
| 100 |
const overlay = document.getElementById("overlay");
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
// Get the button's position
|
| 103 |
const rect = event.target.getBoundingClientRect();
|
| 104 |
-
const popupX = rect.left + window.scrollX + 10; //
|
| 105 |
const popupY = rect.top + window.scrollY + 10;
|
| 106 |
|
| 107 |
// Set the popup's position
|
|
@@ -119,14 +125,21 @@ popup_js = """
|
|
| 119 |
</div>
|
| 120 |
`;
|
| 121 |
|
| 122 |
-
//
|
| 123 |
popup.style.display = "block";
|
| 124 |
overlay.style.display = "block";
|
| 125 |
}
|
| 126 |
|
| 127 |
function closePopup() {
|
|
|
|
| 128 |
const popup = document.getElementById("custom-popup");
|
| 129 |
const overlay = document.getElementById("overlay");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
popup.style.display = "none";
|
| 131 |
overlay.style.display = "none";
|
| 132 |
}
|
|
|
|
| 96 |
popup_js = """
|
| 97 |
<script>
|
| 98 |
function showPopup(event, name, description, price) {
|
| 99 |
+
console.log("Popup triggered"); // Debug: Check if this function is called
|
| 100 |
const popup = document.getElementById("custom-popup");
|
| 101 |
const overlay = document.getElementById("overlay");
|
| 102 |
|
| 103 |
+
if (!popup || !overlay) {
|
| 104 |
+
console.error("Popup or overlay element not found"); // Debug: Log missing elements
|
| 105 |
+
return;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
// Get the button's position
|
| 109 |
const rect = event.target.getBoundingClientRect();
|
| 110 |
+
const popupX = rect.left + window.scrollX + 10; // Add offset for better positioning
|
| 111 |
const popupY = rect.top + window.scrollY + 10;
|
| 112 |
|
| 113 |
// Set the popup's position
|
|
|
|
| 125 |
</div>
|
| 126 |
`;
|
| 127 |
|
| 128 |
+
// Display the popup and overlay
|
| 129 |
popup.style.display = "block";
|
| 130 |
overlay.style.display = "block";
|
| 131 |
}
|
| 132 |
|
| 133 |
function closePopup() {
|
| 134 |
+
console.log("Popup closed"); // Debug: Check if the close function is called
|
| 135 |
const popup = document.getElementById("custom-popup");
|
| 136 |
const overlay = document.getElementById("overlay");
|
| 137 |
+
|
| 138 |
+
if (!popup || !overlay) {
|
| 139 |
+
console.error("Popup or overlay element not found"); // Debug: Log missing elements
|
| 140 |
+
return;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
popup.style.display = "none";
|
| 144 |
overlay.style.display = "none";
|
| 145 |
}
|