Spaces:
Running
Running
Функция добавления чита в корзину сломана, почини её
Browse files- index.html +13 -10
index.html
CHANGED
|
@@ -448,20 +448,23 @@
|
|
| 448 |
setTimeout(() => toast.remove(), 2000);
|
| 449 |
}
|
| 450 |
|
| 451 |
-
//
|
| 452 |
-
document.
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
|
|
|
|
|
|
|
|
|
| 457 |
});
|
| 458 |
-
});
|
| 459 |
|
| 460 |
-
|
| 461 |
-
|
|
|
|
| 462 |
|
| 463 |
// Initialize feather icons
|
| 464 |
feather.replace();
|
| 465 |
-
|
| 466 |
</body>
|
| 467 |
</html>
|
|
|
|
| 448 |
setTimeout(() => toast.remove(), 2000);
|
| 449 |
}
|
| 450 |
|
| 451 |
+
// Initialize cart functionality after DOM is loaded
|
| 452 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 453 |
+
// Attach listeners to all "add to cart" buttons
|
| 454 |
+
document.querySelectorAll('.add-to-cart').forEach(btn => {
|
| 455 |
+
btn.addEventListener('click', function() {
|
| 456 |
+
const product = this.dataset.product;
|
| 457 |
+
const price = this.dataset.price;
|
| 458 |
+
addToCart(product, price);
|
| 459 |
+
});
|
| 460 |
});
|
|
|
|
| 461 |
|
| 462 |
+
// Initialize cart count
|
| 463 |
+
updateCartCount();
|
| 464 |
+
});
|
| 465 |
|
| 466 |
// Initialize feather icons
|
| 467 |
feather.replace();
|
| 468 |
+
</script>
|
| 469 |
</body>
|
| 470 |
</html>
|