Spaces:
Running
Running
Implement product page linking, cart functionality, icons, and animations (#27)
Browse files- Implement product page linking, cart functionality, icons, and animations (a99548a4913172a2ac991c8012e0936289cb65e4)
Co-authored-by: smolSWE Bot <smolSWE@users.noreply.huggingface.co>
- index.html +121 -33
- product.html +51 -2
- script.js +7 -15
- style.css +5 -0
index.html
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
<button class="bg-yellow-500 text-gray-800 px-4 py-2 rounded-md hover:bg-yellow-400">Search</button>
|
18 |
</div>
|
19 |
<div>
|
20 |
-
<a href="/cart.html" class="hover:text-yellow-500"
|
21 |
</div>
|
22 |
</div>
|
23 |
</nav>
|
@@ -40,10 +40,21 @@
|
|
40 |
<h2 class="text-2xl font-bold mb-4">Products</h2>
|
41 |
<div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4">
|
42 |
<!-- Product 1 -->
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
<div class="flex items-center">
|
48 |
<i class="fas fa-star text-yellow-500"></i>
|
49 |
<i class="fas fa-star text-yellow-500"></i>
|
@@ -54,10 +65,21 @@
|
|
54 |
</div>
|
55 |
</div>
|
56 |
<!-- Product 2 -->
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
<div class="flex items-center">
|
62 |
<i class="fas fa-star text-yellow-500"></i>
|
63 |
<i class="fas fa-star text-yellow-500"></i>
|
@@ -68,10 +90,21 @@
|
|
68 |
</div>
|
69 |
</div>
|
70 |
<!-- Product 3 -->
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
<div class="flex items-center">
|
76 |
<i class="fas fa-star text-yellow-500"></i>
|
77 |
<i class="fas fa-star text-yellow-500"></i>
|
@@ -82,10 +115,21 @@
|
|
82 |
</div>
|
83 |
</div>
|
84 |
<!-- Product 4 -->
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
<div class="flex items-center">
|
90 |
<i class="fas fa-star text-yellow-500"></i>
|
91 |
<i class="fas fa-star text-yellow-500"></i>
|
@@ -96,10 +140,21 @@
|
|
96 |
</div>
|
97 |
</div>
|
98 |
<!-- Product 5 -->
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
<div class="flex items-center">
|
104 |
<i class="fas fa-star text-yellow-500"></i>
|
105 |
<i class="fas fa-star text-yellow-500"></i>
|
@@ -110,10 +165,21 @@
|
|
110 |
</div>
|
111 |
</div>
|
112 |
<!-- Product 6 -->
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
<div class="flex items-center">
|
118 |
<i class="fas fa-star text-yellow-500"></i>
|
119 |
<i class="fas fa-star text-yellow-500"></i>
|
@@ -124,10 +190,21 @@
|
|
124 |
</div>
|
125 |
</div>
|
126 |
<!-- Product 7 -->
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
<div class="flex items-center">
|
132 |
<i class="fas fa-star text-yellow-500"></i>
|
133 |
<i class="fas fa-star text-yellow-500"></i>
|
@@ -138,10 +215,21 @@
|
|
138 |
</div>
|
139 |
</div>
|
140 |
<!-- Product 8 -->
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
<div class="flex items-center">
|
146 |
<i class="fas fa-star text-yellow-500"></i>
|
147 |
<i class="fas fa-star text-yellow-500"></i>
|
|
|
17 |
<button class="bg-yellow-500 text-gray-800 px-4 py-2 rounded-md hover:bg-yellow-400">Search</button>
|
18 |
</div>
|
19 |
<div>
|
20 |
+
<a href="/cart.html" class="hover:text-yellow-500"><i class="fas fa-shopping-cart"></i> Cart</a>
|
21 |
</div>
|
22 |
</div>
|
23 |
</nav>
|
|
|
40 |
<h2 class="text-2xl font-bold mb-4">Products</h2>
|
41 |
<div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4">
|
42 |
<!-- Product 1 -->
|
43 |
+
|
44 |
+
<a href="product.html?id=product-1" class="product-card">
|
45 |
+
<img src="https://placehold.co/200x300" alt="Product 1" class="w-full rounded-md">
|
46 |
+
<h3 class="text-lg font-semibold">Product 1</h3>
|
47 |
+
<p class="text-gray-600">$19.99</p>
|
48 |
+
<div class="flex items-center">
|
49 |
+
<i class="fas fa-star text-yellow-500"></i>
|
50 |
+
<i class="fas fa-star text-yellow-500"></i>
|
51 |
+
<i class="fas fa-star text-yellow-500"></i>
|
52 |
+
<i class="fas fa-star text-yellow-500"></i>
|
53 |
+
<i class="fas fa-star-half-alt text-yellow-500"></i>
|
54 |
+
<span class="text-gray-600 ml-2">4.5</span>
|
55 |
+
</div>
|
56 |
+
</a>
|
57 |
+
|
58 |
<div class="flex items-center">
|
59 |
<i class="fas fa-star text-yellow-500"></i>
|
60 |
<i class="fas fa-star text-yellow-500"></i>
|
|
|
65 |
</div>
|
66 |
</div>
|
67 |
<!-- Product 2 -->
|
68 |
+
|
69 |
+
<a href="product.html?id=product-2" class="product-card">
|
70 |
+
<img src="https://placehold.co/200x300" alt="Product 2" class="w-full rounded-md">
|
71 |
+
<h3 class="text-lg font-semibold">Product 2</h3>
|
72 |
+
<p class="text-gray-600">$19.99</p>
|
73 |
+
<div class="flex items-center">
|
74 |
+
<i class="fas fa-star text-yellow-500"></i>
|
75 |
+
<i class="fas fa-star text-yellow-500"></i>
|
76 |
+
<i class="fas fa-star text-yellow-500"></i>
|
77 |
+
<i class="fas fa-star text-yellow-500"></i>
|
78 |
+
<i class="fas fa-star-half-alt text-yellow-500"></i>
|
79 |
+
<span class="text-gray-600 ml-2">4.5</span>
|
80 |
+
</div>
|
81 |
+
</a>
|
82 |
+
|
83 |
<div class="flex items-center">
|
84 |
<i class="fas fa-star text-yellow-500"></i>
|
85 |
<i class="fas fa-star text-yellow-500"></i>
|
|
|
90 |
</div>
|
91 |
</div>
|
92 |
<!-- Product 3 -->
|
93 |
+
|
94 |
+
<a href="product.html?id=product-3" class="product-card">
|
95 |
+
<img src="https://placehold.co/200x300" alt="Product 3" class="w-full rounded-md">
|
96 |
+
<h3 class="text-lg font-semibold">Product 3</h3>
|
97 |
+
<p class="text-gray-600">$19.99</p>
|
98 |
+
<div class="flex items-center">
|
99 |
+
<i class="fas fa-star text-yellow-500"></i>
|
100 |
+
<i class="fas fa-star text-yellow-500"></i>
|
101 |
+
<i class="fas fa-star text-yellow-500"></i>
|
102 |
+
<i class="fas fa-star text-yellow-500"></i>
|
103 |
+
<i class="fas fa-star-half-alt text-yellow-500"></i>
|
104 |
+
<span class="text-gray-600 ml-2">4.5</span>
|
105 |
+
</div>
|
106 |
+
</a>
|
107 |
+
|
108 |
<div class="flex items-center">
|
109 |
<i class="fas fa-star text-yellow-500"></i>
|
110 |
<i class="fas fa-star text-yellow-500"></i>
|
|
|
115 |
</div>
|
116 |
</div>
|
117 |
<!-- Product 4 -->
|
118 |
+
|
119 |
+
<a href="product.html?id=product-4" class="product-card">
|
120 |
+
<img src="https://placehold.co/200x300" alt="Product 4" class="w-full rounded-md">
|
121 |
+
<h3 class="text-lg font-semibold">Product 4</h3>
|
122 |
+
<p class="text-gray-600">$19.99</p>
|
123 |
+
<div class="flex items-center">
|
124 |
+
<i class="fas fa-star text-yellow-500"></i>
|
125 |
+
<i class="fas fa-star text-yellow-500"></i>
|
126 |
+
<i class="fas fa-star text-yellow-500"></i>
|
127 |
+
<i class="fas fa-star text-yellow-500"></i>
|
128 |
+
<i class="fas fa-star-half-alt text-yellow-500"></i>
|
129 |
+
<span class="text-gray-600 ml-2">4.5</span>
|
130 |
+
</div>
|
131 |
+
</a>
|
132 |
+
|
133 |
<div class="flex items-center">
|
134 |
<i class="fas fa-star text-yellow-500"></i>
|
135 |
<i class="fas fa-star text-yellow-500"></i>
|
|
|
140 |
</div>
|
141 |
</div>
|
142 |
<!-- Product 5 -->
|
143 |
+
|
144 |
+
<a href="product.html?id=product-5" class="product-card">
|
145 |
+
<img src="https://placehold.co/200x300" alt="Product 5" class="w-full rounded-md">
|
146 |
+
<h3 class="text-lg font-semibold">Product 5</h3>
|
147 |
+
<p class="text-gray-600">$19.99</p>
|
148 |
+
<div class="flex items-center">
|
149 |
+
<i class="fas fa-star text-yellow-500"></i>
|
150 |
+
<i class="fas fa-star text-yellow-500"></i>
|
151 |
+
<i class="fas fa-star text-yellow-500"></i>
|
152 |
+
<i class="fas fa-star text-yellow-500"></i>
|
153 |
+
<i class="fas fa-star-half-alt text-yellow-500"></i>
|
154 |
+
<span class="text-gray-600 ml-2">4.5</span>
|
155 |
+
</div>
|
156 |
+
</a>
|
157 |
+
|
158 |
<div class="flex items-center">
|
159 |
<i class="fas fa-star text-yellow-500"></i>
|
160 |
<i class="fas fa-star text-yellow-500"></i>
|
|
|
165 |
</div>
|
166 |
</div>
|
167 |
<!-- Product 6 -->
|
168 |
+
|
169 |
+
<a href="product.html?id=product-6" class="product-card">
|
170 |
+
<img src="https://placehold.co/200x300" alt="Product 6" class="w-full rounded-md">
|
171 |
+
<h3 class="text-lg font-semibold">Product 6</h3>
|
172 |
+
<p class="text-gray-600">$19.99</p>
|
173 |
+
<div class="flex items-center">
|
174 |
+
<i class="fas fa-star text-yellow-500"></i>
|
175 |
+
<i class="fas fa-star text-yellow-500"></i>
|
176 |
+
<i class="fas fa-star text-yellow-500"></i>
|
177 |
+
<i class="fas fa-star text-yellow-500"></i>
|
178 |
+
<i class="fas fa-star-half-alt text-yellow-500"></i>
|
179 |
+
<span class="text-gray-600 ml-2">4.5</span>
|
180 |
+
</div>
|
181 |
+
</a>
|
182 |
+
|
183 |
<div class="flex items-center">
|
184 |
<i class="fas fa-star text-yellow-500"></i>
|
185 |
<i class="fas fa-star text-yellow-500"></i>
|
|
|
190 |
</div>
|
191 |
</div>
|
192 |
<!-- Product 7 -->
|
193 |
+
|
194 |
+
<a href="product.html?id=product-7" class="product-card">
|
195 |
+
<img src="https://placehold.co/200x300" alt="Product 7" class="w-full rounded-md">
|
196 |
+
<h3 class="text-lg font-semibold">Product 7</h3>
|
197 |
+
<p class="text-gray-600">$19.99</p>
|
198 |
+
<div class="flex items-center">
|
199 |
+
<i class="fas fa-star text-yellow-500"></i>
|
200 |
+
<i class="fas fa-star text-yellow-500"></i>
|
201 |
+
<i class="fas fa-star text-yellow-500"></i>
|
202 |
+
<i class="fas fa-star text-yellow-500"></i>
|
203 |
+
<i class="fas fa-star-half-alt text-yellow-500"></i>
|
204 |
+
<span class="text-gray-600 ml-2">4.5</span>
|
205 |
+
</div>
|
206 |
+
</a>
|
207 |
+
|
208 |
<div class="flex items-center">
|
209 |
<i class="fas fa-star text-yellow-500"></i>
|
210 |
<i class="fas fa-star text-yellow-500"></i>
|
|
|
215 |
</div>
|
216 |
</div>
|
217 |
<!-- Product 8 -->
|
218 |
+
|
219 |
+
<a href="product.html?id=product-8" class="product-card">
|
220 |
+
<img src="https://placehold.co/200x300" alt="Product 8" class="w-full rounded-md">
|
221 |
+
<h3 class="text-lg font-semibold">Product 8</h3>
|
222 |
+
<p class="text-gray-600">$19.99</p>
|
223 |
+
<div class="flex items-center">
|
224 |
+
<i class="fas fa-star text-yellow-500"></i>
|
225 |
+
<i class="fas fa-star text-yellow-500"></i>
|
226 |
+
<i class="fas fa-star text-yellow-500"></i>
|
227 |
+
<i class="fas fa-star text-yellow-500"></i>
|
228 |
+
<i class="fas fa-star-half-alt text-yellow-500"></i>
|
229 |
+
<span class="text-gray-600 ml-2">4.5</span>
|
230 |
+
</div>
|
231 |
+
</a>
|
232 |
+
|
233 |
<div class="flex items-center">
|
234 |
<i class="fas fa-star text-yellow-500"></i>
|
235 |
<i class="fas fa-star text-yellow-500"></i>
|
product.html
CHANGED
@@ -48,7 +48,7 @@
|
|
48 |
<i class="fas fa-star-half-alt text-yellow-500"></i>
|
49 |
<span class="text-gray-600 ml-2">4.5</span>
|
50 |
</div>
|
51 |
-
<button class="bg-yellow-500 text-gray-800 px-4 py-2 rounded-md hover:bg-yellow-400" id="addToCartButton"
|
52 |
</div>
|
53 |
</div>
|
54 |
</main>
|
@@ -57,10 +57,53 @@
|
|
57 |
<p>© 2024 Amazon Clone</p>
|
58 |
</footer>
|
59 |
|
60 |
-
<script src="script.js"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
<script src="data.js"></script>
|
62 |
|
63 |
<script>
|
|
|
|
|
|
|
64 |
document.addEventListener('DOMContentLoaded', function() {
|
65 |
const product = products[0];
|
66 |
trackProductView(product.id);
|
@@ -69,12 +112,18 @@
|
|
69 |
|
70 |
|
71 |
<script>
|
|
|
|
|
|
|
72 |
document.addEventListener('DOMContentLoaded', function() {
|
73 |
trackProductView('product123');
|
74 |
});
|
75 |
</script>
|
76 |
|
77 |
<script>
|
|
|
|
|
|
|
78 |
const productNameElement = document.getElementById('productName');
|
79 |
const productDescriptionElement = document.getElementById('productDescription');
|
80 |
const productPriceElement = document.getElementById('productPrice');
|
|
|
48 |
<i class="fas fa-star-half-alt text-yellow-500"></i>
|
49 |
<span class="text-gray-600 ml-2">4.5</span>
|
50 |
</div>
|
51 |
+
<button class="bg-yellow-500 text-gray-800 px-4 py-2 rounded-md hover:bg-yellow-400 add-to-cart-button" id="addToCartButton"><i class="fas fa-cart-plus"></i> Add to Cart</button>
|
52 |
</div>
|
53 |
</div>
|
54 |
</main>
|
|
|
57 |
<p>© 2024 Amazon Clone</p>
|
58 |
</footer>
|
59 |
|
60 |
+
<script src="script.js">
|
61 |
+
const urlParams = new URLSearchParams(window.location.search);
|
62 |
+
const productId = urlParams.get("id");
|
63 |
+
|
64 |
+
document.addEventListener('DOMContentLoaded', function() {
|
65 |
+
if (productId) {
|
66 |
+
const product = products.find(p => p.id === productId);
|
67 |
+
|
68 |
+
if (product) {
|
69 |
+
document.getElementById('productName').textContent = product.name;
|
70 |
+
document.getElementById('productDescription').textContent = product.description;
|
71 |
+
document.getElementById('productPrice').textContent = '$' + product.price.toFixed(2);
|
72 |
+
// Assuming you have an image element with id 'productImage'
|
73 |
+
// document.getElementById('productImage').src = product.image;
|
74 |
+
// document.getElementById('productImage').alt = product.name;
|
75 |
+
} else {
|
76 |
+
console.error('Product not found with ID:', productId);
|
77 |
+
document.getElementById('productName').textContent = 'Product Not Found';
|
78 |
+
}
|
79 |
+
} else {
|
80 |
+
console.error('Product ID not provided.');
|
81 |
+
document.getElementById('productName').textContent = 'Product ID Not Provided';
|
82 |
+
}
|
83 |
+
|
84 |
+
const addToCartButton = document.getElementById('addToCartButton');
|
85 |
+
if (addToCartButton) {
|
86 |
+
addToCartButton.addEventListener('click', () => {
|
87 |
+
if (productId) {
|
88 |
+
const product = products.find(p => p.id === productId);
|
89 |
+
if (product) {
|
90 |
+
addToCart(product);
|
91 |
+
} else {
|
92 |
+
console.error('Product not found with ID:', productId);
|
93 |
+
}
|
94 |
+
} else {
|
95 |
+
console.error('Product ID not provided.');
|
96 |
+
}
|
97 |
+
});
|
98 |
+
}
|
99 |
+
});
|
100 |
+
</script>
|
101 |
<script src="data.js"></script>
|
102 |
|
103 |
<script>
|
104 |
+
const urlParams = new URLSearchParams(window.location.search);
|
105 |
+
const productId = urlParams.get("id");
|
106 |
+
|
107 |
document.addEventListener('DOMContentLoaded', function() {
|
108 |
const product = products[0];
|
109 |
trackProductView(product.id);
|
|
|
112 |
|
113 |
|
114 |
<script>
|
115 |
+
const urlParams = new URLSearchParams(window.location.search);
|
116 |
+
const productId = urlParams.get("id");
|
117 |
+
|
118 |
document.addEventListener('DOMContentLoaded', function() {
|
119 |
trackProductView('product123');
|
120 |
});
|
121 |
</script>
|
122 |
|
123 |
<script>
|
124 |
+
const urlParams = new URLSearchParams(window.location.search);
|
125 |
+
const productId = urlParams.get("id");
|
126 |
+
|
127 |
const productNameElement = document.getElementById('productName');
|
128 |
const productDescriptionElement = document.getElementById('productDescription');
|
129 |
const productPriceElement = document.getElementById('productPrice');
|
script.js
CHANGED
@@ -41,6 +41,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
41 |
}
|
42 |
|
43 |
setCartItems(cartItems);
|
|
|
44 |
updateCartUI();
|
45 |
}
|
46 |
|
@@ -57,21 +58,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
57 |
}
|
58 |
|
59 |
setCartItems(cartItems);
|
60 |
-
|
61 |
-
}
|
62 |
-
|
63 |
-
function addToCart(product) {
|
64 |
-
let cartItems = getCartItems();
|
65 |
-
const existingItem = cartItems.find(item => item.id === product.id);
|
66 |
-
|
67 |
-
if (existingItem) {
|
68 |
-
existingItem.quantity += 1;
|
69 |
-
} else {
|
70 |
-
product.quantity = 1;
|
71 |
-
cartItems.push(product);
|
72 |
-
}
|
73 |
-
|
74 |
-
setCartItems(cartItems);
|
75 |
updateCartUI();
|
76 |
}
|
77 |
|
@@ -86,6 +73,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
86 |
cartItems.splice(itemIndex, 1); // Remove item if quantity is 0 or less
|
87 |
}
|
88 |
setCartItems(cartItems);
|
|
|
89 |
updateCartUI();
|
90 |
}
|
91 |
updateCartUI(); // Call updateCartUI to update the order summary
|
@@ -99,6 +87,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
99 |
if (itemIndex !== -1) {
|
100 |
cartItems.splice(itemIndex, 1);
|
101 |
setCartItems(cartItems);
|
|
|
102 |
updateCartUI();
|
103 |
}
|
104 |
}
|
@@ -151,6 +140,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
151 |
removeButton.addEventListener('click', function() {
|
152 |
const productId = this.dataset.productId;
|
153 |
removeItem(productId);
|
|
|
154 |
});
|
155 |
});
|
156 |
|
@@ -164,6 +154,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
164 |
quantity = Math.max(1, quantity - 1); // Ensure quantity is not less than 1
|
165 |
quantityInput.value = quantity;
|
166 |
updateQuantity(productId, quantity);
|
|
|
167 |
});
|
168 |
});
|
169 |
|
@@ -176,6 +167,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
176 |
quantity++;
|
177 |
quantityInput.value = quantity;
|
178 |
updateQuantity(productId, quantity);
|
|
|
179 |
});
|
180 |
});
|
181 |
}
|
|
|
41 |
}
|
42 |
|
43 |
setCartItems(cartItems);
|
44 |
+
console.log("Cart updated:", cartItems);
|
45 |
updateCartUI();
|
46 |
}
|
47 |
|
|
|
58 |
}
|
59 |
|
60 |
setCartItems(cartItems);
|
61 |
+
console.log("Cart updated:", cartItems);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
updateCartUI();
|
63 |
}
|
64 |
|
|
|
73 |
cartItems.splice(itemIndex, 1); // Remove item if quantity is 0 or less
|
74 |
}
|
75 |
setCartItems(cartItems);
|
76 |
+
console.log("Cart updated:", cartItems);
|
77 |
updateCartUI();
|
78 |
}
|
79 |
updateCartUI(); // Call updateCartUI to update the order summary
|
|
|
87 |
if (itemIndex !== -1) {
|
88 |
cartItems.splice(itemIndex, 1);
|
89 |
setCartItems(cartItems);
|
90 |
+
console.log("Cart updated:", cartItems);
|
91 |
updateCartUI();
|
92 |
}
|
93 |
}
|
|
|
140 |
removeButton.addEventListener('click', function() {
|
141 |
const productId = this.dataset.productId;
|
142 |
removeItem(productId);
|
143 |
+
console.log("Item removed:", productId);
|
144 |
});
|
145 |
});
|
146 |
|
|
|
154 |
quantity = Math.max(1, quantity - 1); // Ensure quantity is not less than 1
|
155 |
quantityInput.value = quantity;
|
156 |
updateQuantity(productId, quantity);
|
157 |
+
console.log("Quantity updated:", productId, quantity);
|
158 |
});
|
159 |
});
|
160 |
|
|
|
167 |
quantity++;
|
168 |
quantityInput.value = quantity;
|
169 |
updateQuantity(productId, quantity);
|
170 |
+
console.log("Quantity updated:", productId, quantity);
|
171 |
});
|
172 |
});
|
173 |
}
|
style.css
CHANGED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.add-to-cart-button:hover {
|
3 |
+
transform: scale(1.05);
|
4 |
+
transition: transform 0.2s ease-in-out;
|
5 |
+
}
|