Update index.html
Browse files- index.html +3 -19
index.html
CHANGED
|
@@ -1130,11 +1130,10 @@ if (tickerComponent) {
|
|
| 1130 |
});
|
| 1131 |
}
|
| 1132 |
|
| 1133 |
-
// --- Details View Logic (MODIFIED) ---
|
| 1134 |
const detailsContainer = document.getElementById('product-ticker-details-container');
|
| 1135 |
const itemsData = JSON.parse(tickerComponent.dataset.items.replace(/'/g, "'"));
|
| 1136 |
const tickerItems = tickerComponent.querySelectorAll('.ticker-item');
|
| 1137 |
-
let detailViewTimeout;
|
| 1138 |
|
| 1139 |
const showDetails = (item) => {
|
| 1140 |
if (!item || !detailsContainer) return;
|
|
@@ -1171,30 +1170,15 @@ if (tickerComponent) {
|
|
| 1171 |
if (detailsContainer) detailsContainer.classList.remove('visible');
|
| 1172 |
};
|
| 1173 |
|
| 1174 |
-
const startHideTimer = () => {
|
| 1175 |
-
clearTimeout(detailViewTimeout);
|
| 1176 |
-
detailViewTimeout = setTimeout(hideDetails, 300);
|
| 1177 |
-
};
|
| 1178 |
-
|
| 1179 |
-
const cancelHideTimer = () => {
|
| 1180 |
-
clearTimeout(detailViewTimeout);
|
| 1181 |
-
};
|
| 1182 |
-
|
| 1183 |
tickerItems.forEach(tickerItem => {
|
| 1184 |
-
tickerItem.addEventListener('
|
| 1185 |
-
|
| 1186 |
const index = e.currentTarget.dataset.itemIndex;
|
| 1187 |
showDetails(itemsData[index]);
|
| 1188 |
});
|
| 1189 |
-
tickerItem.addEventListener('mouseleave', startHideTimer);
|
| 1190 |
});
|
| 1191 |
|
| 1192 |
if (detailsContainer) {
|
| 1193 |
-
// When mouse enters the container, it's over the card, so cancel the hide timer
|
| 1194 |
-
detailsContainer.addEventListener('mouseenter', cancelHideTimer);
|
| 1195 |
-
// When mouse leaves the container (and the card within it), start the hide timer
|
| 1196 |
-
detailsContainer.addEventListener('mouseleave', startHideTimer);
|
| 1197 |
-
|
| 1198 |
// Add a click listener to the container (the overlay)
|
| 1199 |
detailsContainer.addEventListener('click', (e) => {
|
| 1200 |
// If the click is on the background (the container itself) and not the card, hide immediately.
|
|
|
|
| 1130 |
});
|
| 1131 |
}
|
| 1132 |
|
| 1133 |
+
// --- Details View Logic (MODIFIED FOR CLICK) ---
|
| 1134 |
const detailsContainer = document.getElementById('product-ticker-details-container');
|
| 1135 |
const itemsData = JSON.parse(tickerComponent.dataset.items.replace(/'/g, "'"));
|
| 1136 |
const tickerItems = tickerComponent.querySelectorAll('.ticker-item');
|
|
|
|
| 1137 |
|
| 1138 |
const showDetails = (item) => {
|
| 1139 |
if (!item || !detailsContainer) return;
|
|
|
|
| 1170 |
if (detailsContainer) detailsContainer.classList.remove('visible');
|
| 1171 |
};
|
| 1172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1173 |
tickerItems.forEach(tickerItem => {
|
| 1174 |
+
tickerItem.addEventListener('click', (e) => {
|
| 1175 |
+
e.preventDefault(); // Prevent the link from being followed immediately
|
| 1176 |
const index = e.currentTarget.dataset.itemIndex;
|
| 1177 |
showDetails(itemsData[index]);
|
| 1178 |
});
|
|
|
|
| 1179 |
});
|
| 1180 |
|
| 1181 |
if (detailsContainer) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1182 |
// Add a click listener to the container (the overlay)
|
| 1183 |
detailsContainer.addEventListener('click', (e) => {
|
| 1184 |
// If the click is on the background (the container itself) and not the card, hide immediately.
|