-
Notifications
You must be signed in to change notification settings - Fork 1
/
gifts.html
430 lines (402 loc) · 15.1 KB
/
gifts.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="common.css" />
</head>
<body>
<div class="nav">
<div class="guest">
<a href="guest.html"> <h1>Guest Services</h1></a>
</div>
<div class="logo">
<img
onclick="window.location.href='index.html'"
src="https://shopdisney.in/media/logo/stores/1/shopDisney_1.png"
alt=""
/>
</div>
<div class="nav-right">
<div class="sign">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<path
d="M224 256c70.7 0 128-57.31 128-128s-57.3-128-128-128C153.3 0 96 57.31 96 128S153.3 256 224 256zM274.7 304H173.3C77.61 304 0 381.6 0 477.3c0 19.14 15.52 34.67 34.66 34.67h378.7C432.5 512 448 496.5 448 477.3C448 381.6 370.4 304 274.7 304z"
/>
</svg>
<span id="para">Hi Shrey!</span>
</div>
<div class="wishList">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
<path
d="M0 190.9V185.1C0 115.2 50.52 55.58 119.4 44.1C164.1 36.51 211.4 51.37 244 84.02L256 96L267.1 84.02C300.6 51.37 347 36.51 392.6 44.1C461.5 55.58 512 115.2 512 185.1V190.9C512 232.4 494.8 272.1 464.4 300.4L283.7 469.1C276.2 476.1 266.3 480 256 480C245.7 480 235.8 476.1 228.3 469.1L47.59 300.4C17.23 272.1 .0003 232.4 .0003 190.9L0 190.9z"
/>
</svg>
<a href="">My Wishlist</a>
</div>
<div class="cart">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
<path
d="M112 112C112 50.14 162.1 0 224 0C285.9 0 336 50.14 336 112V160H400C426.5 160 448 181.5 448 208V416C448 469 405 512 352 512H96C42.98 512 0 469 0 416V208C0 181.5 21.49 160 48 160H112V112zM160 160H288V112C288 76.65 259.3 48 224 48C188.7 48 160 76.65 160 112V160zM136 256C149.3 256 160 245.3 160 232C160 218.7 149.3 208 136 208C122.7 208 112 218.7 112 232C112 245.3 122.7 256 136 256zM312 208C298.7 208 288 218.7 288 232C288 245.3 298.7 256 312 256C325.3 256 336 245.3 336 232C336 218.7 325.3 208 312 208z"
/>
</svg>
<a href="">My Bag</a>
</div>
</div>
</div>
<br />
<div class="nav-2">
<div class="sale">
<a href="deals.html"><h1>NEW</h1></a>
<h1>|</h1>
<a href="deals.html"><h1>SALE</h1></a>
</div>
<div class="opt">
<a href="gifts.html"><h1>GIFTS</h1></a>
<a href="fashion.html"><h1>FASHION AND ACCESSORIES</h1></a>
<a href="toys.html"><h1>TOYS</h1></a>
<a href="backtoschool.html"> <h1>BACK TO SCHOOL</h1></a>
<a href="afterSign.html"><h1>HOME</h1></a>
<a href="gadgets.html"><h1>GADGETS</h1></a>
</div>
<div class="search-container">
<input type="text" class="search-box" placeholder="Search..." />
<button class="search-button">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
<path
d="M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z"
/>
</svg>
</button>
</div>
</div>
<div id="pic">
<img
src="https://shopdisney.in/media/March/2022/banner/d_Gifts.jpg"
alt=""
/>
</div>
<div id="text">
<p>ShopDisney / Fashion & Accessories</p>
</div>
<div id="flex">
<div id="filter">
<select id="sortNames" onchange="handleNameSort()">
<option value="">Sort By Names</option>
<option value="ascending">Ascending</option>
<option value="descending">Descending</option>
</select>
<br />
<select
name="Sort by price"
id="sortprice"
onchange="handlePriceSort()"
>
<option value="">Sort By Price</option>
<option value="htl">High To Low</option>
<option value="lth">Low To High</option>
</select>
<!-- <select id="filtercat" onchange="handleCatSort()">
<option value="">Filter by catagery</option>
<option value="clothes">Clothes</option>
<option value="Shoes">Foot Wear</option>
<option value="Bag">Bag</option>
</select> -->
</div>
<div id="grid"></div>
</div>
</body>
</html>
<script>
cartdata = JSON.parse(localStorage.getItem("cart")) || [];
giftsdata = [
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/d/d/ddm-1988-288-ptd.jpg",
Name: "Disney Princess Dream Mug Multicolor",
Strikeoffprice: 299,
Price: 199,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/d/i/disney_minnie_speed_stainless_steel_bottle_650_ml_1.png",
Name: "Disney Minnie Mouse Speed Stainless Steel Bottle, 650 ML Pink",
Strikeoffprice: 499,
Price: 425,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/d/i/disney_minnie_pluto_stainless_steel_bottle_800_ml_1.png",
Name: "Disney Minnie Mouse Pluto Stainless Steel",
Strikeoffprice: 649,
Price: 520,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/d/i/disney_minnie_pluto_stainless_steel_bottle_600_ml_1.png",
Name: "Disney Mickey Mouse Pluto Stainless Steel ",
Strikeoffprice: 549,
Price: 467,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/d/i/disney_mickey_pluto_stainless_steel_bottle_600_ml_1.png",
Name: "Disney Minnie Mouse Pluto Stainless Steel",
Strikeoffprice: 549,
Price: 467,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/d/i/disney_minnie_fizzy_stainless_steel_bottle_800_ml_1.png",
Name: "Disney Mickey Mouse Pluto Stainless Steel ",
Strikeoffprice: 599,
Price: 480,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/d/i/disney_princess_kiddo_stainless_steel_insulated_bottle_500_ml_1_1.jpg",
Name: "Disney Princess Kiddo Stainless Steel ",
Strikeoffprice: 912,
Price: 776,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/d/i/disney_minnie_kiddo_stainless_steel_insulated_bottle_500_ml_1.jpg",
Name: "Disney Minnie Mouse Kiddo Stainless Steel ",
Strikeoffprice: 912,
Price: 776,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/d/i/disney_princess_cool_star_stainless_steel_insulated_bottle_450_ml_1_1.jpg",
Name: "Disney Princess Cool Star Stainless Steel ",
Strikeoffprice: 999,
Price: 850,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/d/i/disney_frozen_cool_star_stainless_steel_insulated_bottle_450_ml_1_1.jpg",
Name: "Disney Frozen Cool Star Stainless Steel",
Strikeoffprice: 999,
Price: 850,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/a/marvel_spiderman_folding_desk_5_1.jpg",
Name: "Marvel Spider-Man Folding Desk Red-Size",
Strikeoffprice: 1239,
Price: 1054,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/d/i/disney_mickey_folding_desk_1.jpg",
Name: "Disney Mickey Mouse Folding Desk",
Strikeoffprice: 1239,
Price: 10584,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/d/i/disney_princess_junior_table_1.jpg",
Name: "Disney Princess Junior Table Pink-Size Onesize",
Strikeoffprice: 1249,
Price: 1062,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/d/i/disney_mickey_junior_table_1.jpg",
Name: "Disney Mickey Mouse Junior Table Blue-Size Onesize",
Strikeoffprice: 1249,
Price: 1062,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/a/v/avengers_mug2.jpg",
Name: "Marvel Avengers Mug - Rainbow Marvel Collection Multicolor",
Strikeoffprice: 499,
Price: 399,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/q/m/qmxmvl-0047_1__1.jpg",
Name: "Marvel X-Men - Cyclops Q-Fig Diorama Figure Multicolor",
Strikeoffprice: 2499,
Price: 1999,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/i/micky2_3_2.jpg",
Name: "Disney Mickey & Friends Face Covering",
Strikeoffprice: 895,
Price: 595,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/4/1/4103_3.jpg",
Name: "Disney Princess Pencil Box Set Of 2- Pink",
Strikeoffprice: 359,
Price: 299,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/a/marvel_tote_bag_1.jpg",
Name: "Marvel Logo Tote Bag - Rainbow Marvel Collection Multicolor",
Strikeoffprice: 349,
Price: 299,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/9/7/9781787415485.jpg",
Name: "Disney: A Frozen World Book-Multicolor",
Strikeoffprice: 795,
Price: 629,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/i/mickey5in1easel_1.jpg",
Name: "Disney Mickey & Friends 5 in 1 Writing Board",
Strikeoffprice: 1599,
Price: 1199,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/5/9/5976-1.jpg",
Name: "Disney Frozen 2 Pcs Hair Bands & 2 Pcs Hair Clips for Kids",
Strikeoffprice: 169,
Price: 152,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/f/u/fu35774_1_.jpg",
Name: "Marvel Infinity war s2 -youn g Gamora",
Strikeoffprice: 1099,
Price: 799,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/f/u/fu36671.jpeg",
Name: "Marvel Avengers Endgame - Smart Hulk",
Strikeoffprice: 1399,
Price: 1099,
// Catagery:""
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/f/u/fu26480.jpg",
Name: "Marvel Infinity War - Thanos Baby Action Figure",
Strikeoffprice: 899,
Price: 599,
// Catagery:""
},
];
displayData(giftsdata);
function handlePriceSort() {
console.log("YES");
var sort = document.querySelector("#sortprice").value;
if (sort == "htl") {
giftsdata.sort(function (a, b) {
return b.Price - a.Price;
});
displayData(giftsdata);
}
if (sort == "lth") {
giftsdata.sort(function (a, b) {
return a.Price - b.Price;
});
displayData(giftsdata);
}
}
function handleNameSort() {
// console.log("Yes")
var sort = document.querySelector("#sortNames").value;
// console.log(sort)
if (sort == "ascending") {
giftsdata.sort(function (a, b) {
if (a.Name > b.Name) return 1;
if (a.Name < b.Name) return -1;
return 0;
});
console.log("Yes");
displayData(giftsdata);
}
if (sort == "descending") {
giftsdata.sort(function (a, b) {
if (a.Name > b.Name) return -1;
if (a.Name < b.Name) return 1;
return 0;
});
console.log("NOO");
displayData(giftsdata);
}
}
// function handleCatSort(){
// var sort = document.querySelector("#filtercat").value
// if(sort == "T-shirt"){
// var Tshirt = toysdata.catagery == "T-shirt"
// displayData(toysdata.catagery == Tshirt)
// console.log("Bag")
// }
// }
function displayData(giftsdata) {
document.querySelector("#grid").innerHTML = "";
giftsdata.map(function (elem) {
var maindiv = document.createElement("div");
maindiv.setAttribute("id", "maindiv");
var div1 = document.createElement("div");
var image = document.createElement("img");
image.src = elem.Image;
image.setAttribute("id", "img");
var name = document.createElement("p");
name.innerText = elem.Name;
div1.append(image, name);
var pricediv = document.createElement("div");
pricediv.setAttribute("id", "pricediv");
var strprice = document.createElement("p");
strprice.innerText = "₹" + " " + elem.Strikeoffprice;
strprice.setAttribute("id", "strike");
var price = document.createElement("P");
price.innerText = "₹" + " " + elem.Price;
var cart = document.createElement("button");
cart.innerText = "Add to cart";
cart.setAttribute("id", "btn");
cart.addEventListener("click", function () {
cartfun(elem);
});
pricediv.append(strprice, price);
maindiv.append(div1, pricediv, cart);
document.querySelector("#grid").append(maindiv);
});
}
function cartfun(elem) {
cartdata.push(elem);
localStorage.setItem("cart", JSON.stringify(cartdata));
alert("Item added to cart");
console.log(cartdata);
}
</script>