-
Notifications
You must be signed in to change notification settings - Fork 0
/
earring.html
437 lines (427 loc) · 16 KB
/
earring.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
431
432
433
434
435
436
437
<!DOCTYPE html>
<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>EarRings</title>
<link rel="stylesheet" href="product.css">
</head>
<style>
#ear{
display: flex;
}
.ear{
width: 50%;
}
</style>
<body>
<div>
<div id="ear">
<img class="ear" src="https://banner.caratlane.com/live-images/cd406cb7601640dab6233b01a33d197e.jpg" alt="">
<img class="ear" src="https://banner.caratlane.com/live-images/8e1c187cf0cc40808d894d0f2d49a125.jpg" alt="">
</div>
<div id="select">
<select id="pricesort" onchange="sortByprice()">
<option value="">PRICE</option>
<option value="high">High To Low</option>
<option value="low">Low To High</option>
</select>
<select name="forma" onchange="location = this.value">
<option value="earrings.html">PRODUCT TYPE</option>
<option value="ring.html">Rings</option>
<option value="bangles.html">Bangles & Bracelets</option>
<option value="earring.html">EarRings</option>
</Select>
<select>
<option>WEIGHT RANGES</option>
<option value="">0 - 2 g</option>
<option value="">2 - 5 g</option>
<option value="">5 - 10 g</option>
<option value="">10 - 20 g</option>
</select>
<select>
<option>MATERIAL</option>
<option value="">Gold</option>
<option value="">Silver</option>
<option value="">Diamond</option>
<option value="">Platinum</option>
</select>
<select>
<option>METAL</option>
<option value="">18 Kt Yellow</option>
<option value="">18 Kt White</option>
<option value="">18 Kt Rose</option>
<option value="">18 Kt Two Tone</option>
<option value="">14 Kt Yellow</option>
<option value="">14 Kt White</option>
<option value="">14 Kt Rose</option>
</select>
<select>
<option>SEE MORE FILTERS</option>
<option>Ring Size</option>
<option>Shop For</option>
<option>Ring Style</option>
<option>Gifts</option>
<option>Theme</option>
</select>
</div>
<div id="filter">
<div class="moresort">
<button>All Rings</button>
<button>Try At Home</button>
<button>Designs in Store</button>
<button>Fast Delivery</button>
</div>
<div class="feat">
<select id="PriceSort" onchange="SortByPrice()">
<option>Sort By:Featured</option>
<option>Discount</option>
<option value="low">Price:Low To High</option>
<option value="high">Price:High To Low</option>
<option>Latest</option>
<option>Featured</option>
</select>
</div>
</div>
</div>
<div id="container">
</div>
</body>
</html>
<script>
Earcart=JSON.parse(localStorage.getItem("cartData")) || [] ;
Earwish=JSON.parse(localStorage.getItem("wishlistData")) || [] ;
window.addEventListener("load", function () {
displayData(Earrings);
});
function sortByprice() {
var selected = document.querySelector("#pricesort").value;
if (selected == "high") {
var x= Earrings.sort(function (a, b) {
return b.price- a.price
});
displayData(x);
}
if (selected == "low") {
var y= Earrings.sort(function (a, b) {
return a.price - b.price
});
displayData(y);
}
}
function SortByPrice() {
var selected = document.querySelector("#PriceSort").value;
if (selected == "high") {
var z= Earrings.sort(function (a, b) {
return b.price- a.price
});
displayData(z);
}
if (selected == "low") {
var p= Earrings.sort(function (a, b) {
return a.price - b.price
});
displayData(p);
}
}
var Earrings = [
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE06188-1RP900_11_listfront.jpg",
name: "Glinting Butterfly Diamond Stud Earrings",
price: 9191,
strikedoffprice: 10211,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE01784-YGP900_11_listfront.jpg",
name: "Aara Swirl Diamond Stud Earrings",
price: 25849,
strikedoffprice: 28296,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE04010-YGP900_11_listfront.jpg",
name: "Northstar Diamond Stud Earrings",
price: 14311,
strikedoffprice: 16836,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE03935-WGP900_11_listfront.jpg",
name: "Fine Heart Diamond Stud Earrings",
price: 14509,
strikedoffprice: 18136,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE05167-1RP900_11_listfront.jpg",
name: "Arc Geometric Diamond Stud Earrings",
price: 17958,
strikedoffprice: 19946,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE04425-RGP900_11_listfront.jpg",
name: "Floret Miracle Plate Diamond Stud Earrings",
price: 19191,
strikedoffprice: 22578,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE06630-1YP900_11_listfront.jpg",
name: "Dew Cluster Diamond Drop Earrings",
price: 8192,
strikedoffprice: 9639,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE02487-YGP900_11_listfront.jpg",
name: "Sangamini Diamond Drop Earrings",
price: 25078 ,
strikedoffprice: 28341,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE04075-YGP900_11_listfront.jpg",
name: "Star Diamond Stud Earrings",
price: 15063,
strikedoffprice: 18828,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE02848-YGP900_11_listfront.jpg",
name: "Floweret Diamond Stud Earrings",
price: 43252,
strikedoffprice: 49982,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE02419-YGP900_11_listfront.jpg",
name: "Trio Poire Diamond Drop Earrings",
price: 23413,
strikedoffprice: 25921,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE06303-1PP900_11_listfront.jpg",
name: "Cyra Diamond Drop Earrings",
price: 71998,
strikedoffprice: 84050,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE04394-YGP9EB_11_listfront.jpg",
name: "Flitter Blue Butterfly Diamond Ear Cuffs",
price: 37179,
strikedoffprice: 39167,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE06721-1YP9P0_11_listfront.jpg",
name: "Intertwine Circlet Pearl Drop Earrings",
price: 11043,
strikedoffprice: 12991,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE04059-YGP900_11_listfront.jpg",
name: "Classic Leaves Diamond Stud Earrings",
price: 19716,
strikedoffprice: 21277,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE06075-1YP900_11_listfront.jpg",
name: "Evie Detachable Diamond Stud Earrings",
price: 31394,
strikedoffprice: 36493,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE05166-1RP900_11_listfront.jpg",
name: "Daisy Floret Diamond Stud Earrings",
price: 13955,
strikedoffprice: 14690,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE06155-1RP900_11_listfront.jpg",
name: "Pleasing Petals Diamond Stud Earrings",
price: 27499,
strikedoffprice: 30558,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//U/E/UE04382-1R00P0_11_listfront.jpg",
name: "Pearl Heart Stud Earrings",
price: 10082,
strikedoffprice: 10638,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE06140-1YP900_11_listfront.jpg",
name: "Dancing Queen Diamond Stud Earrings",
price: 22557,
strikedoffprice: 26538,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE03396-YGP900_11_listfront.jpg",
name: "Ava Intertwined Diamond Stud Earrings",
price: 25750,
strikedoffprice: 27382,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE03164-YGP900_11_listfront.jpg",
name: "Paisley Swirl Diamond Stud Earrings",
price: 27630,
strikedoffprice: 30485,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE00939-PTP200_11_listfront.jpg",
name: "Svelte Platinum Stud Earrings",
price: 21626,
strikedoffprice: 25442,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE02849-YGP900_11_listfront.jpg",
name: "Golden Floret Diamond Stud Earrings",
price: 29271,
strikedoffprice: 33839,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE02426-YGP900_11_listfront.jpg",
name: "Sparkle Lattice Diamond Stud Earrings",
price: 30113,
strikedoffprice: 34151,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE03360-YGP900_11_listfront.jpg",
name: "Catia Stardom Diamond Stud Earrings",
price: 22609,
strikedoffprice: 24169,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE05545-1RP900_11_listfront.jpg",
name: "Simply Knot Diamond Stud Earrings",
price: 20046,
strikedoffprice: 21943,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE04221-YGP900_11_listfront.jpg",
name: "Alder Root Diamond Stud Earrings",
price: 66846,
strikedoffprice: 73117,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE06478-1YP9P0_11_listfront.jpg",
name: "Furl Love Pearl Stud Earrings",
price: 12977,
strikedoffprice: 14419,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE03282-YGP900_11_listfront.jpg",
name: "Eyelet Diamond Stud Earrings",
price: 19258 ,
strikedoffprice: 22657,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE02428-YGP900_11_listfront.jpg",
name: "Antique Sun Diamond Stud Earrings",
price: 65510,
strikedoffprice: 73922,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE06875-1YP900_11_listfront.jpg",
name: "Ebony Diamond Stud Earrings",
price: 29258,
strikedoffprice: 32011,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE03084-YGP900_11_listfront.jpg",
name: "Sparkle Cluster Diamond Stud Earrings",
price: 32164,
strikedoffprice: 37160,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE06905-1RP9P0_11_listfront.jpg",
name: "Avisa Gemstone Drop Earrings",
price: 25307 ,
strikedoffprice: 26123,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE01811-YGP900_11_listfront.jpg",
name: "Eartha Cluster Diamond Stud Earrings",
price: 18258,
strikedoffprice: 21480,
},
{
img:
"https://cdn.caratlane.com/media/catalog/product/cache/6/image/480x480/9df78eab33525d08d6e5fb8d27136e95//J/E/JE06589-YGP900_11_listfront.jpg",
name: "Golden Hour Diamond Stud Earrings",
price: 32941,
strikedoffprice: 36601,
}];
function displayData(Earrings){
document.querySelector("#container").innerText="";
Earrings.map(function(el){
var div = document.createElement("div");
var pic=document.createElement("div");
var image=document.createElement("img");
image.src=el.img;
var productprice=document.createElement("span");
productprice.innerText=el.price;
var striked=document.createElement("span");
striked.innerText=el.strikedoffprice;
striked.style.textDecoration="line-through"
striked.style.fontWeight="100"
var itemname=document.createElement("p");
itemname.innerText=el.name;
var btn1=document.createElement("button");
btn1.innerText="Add To Cart";
btn1.setAttribute("class","btn1")
btn1.addEventListener("click",function(){
cartbutton(el);
})
var btn2=document.createElement("button");
btn2.innerText="Add to WishList"
btn2.setAttribute("class","btn2")
btn2.addEventListener("click",function(){
wishbutton(el);
})
pic.append(image);
div.append(pic,productprice,striked,itemname,btn1,btn2);
document.querySelector("#container").append(div);
})
}
function cartbutton(el)
{
alert("Item Added To Cart");
window.location.reload();
Earcart.push(el);
localStorage.setItem("cartData",JSON.stringify(Earcart));
}
function wishbutton(el)
{
alert("Item Added To WishList");
window.location.reload();
Earwish.push(el);
localStorage.setItem("wishlistData",JSON.stringify(Earwish));
}
</script>