-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmens.js
530 lines (404 loc) · 18.1 KB
/
mens.js
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
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
// Cards Grid
let objArr = [
{
price: 559,
mrp: 799,
name: "MAX Men Solid Slim Fit Polo T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010533095-Green-Oliveg-1000010533095-7092021_01-2100.jpeg",
},
{
price: 559,
mrp: 799,
name: "MAX Men Solid Slim Fit Polo T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010533095-Yellow-Mustard-1000010533095-7092021_01-2100.jpg",
},
{
price: 909,
mrp: 1299,
name: "MAX Men Solid Crew Neck T-shirt - Set of 2",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010541287-Black-Black-1000010541287-7092021_01-2100.jpg"
},
{
price: 909,
mrp: 1299,
name: "MAX Men Solid Slim Fit Polo T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010533095-Red-Red-1000010533095-7092021_01-2100.jpg"
},
{
price: 750,
mrp: 1499,
name: "MAX Men Solid Crew Neck T-shirt - Set of 2",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010541378-Grey-Chrmel-1000010541378-7092021_01-2100.jpg"
},
{
price: 850,
mrp: 1699,
name: "MAX Men Textured Crew Neck T-shirt- Pack of 2",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010541300-Blue-Navy-1000010541300-7092021_01-2100.jpg"
},
{
price: 349,
mrp: 499,
name: "MAX Men Solid Crew Neck T-shirt- Set of 2",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010541326-Grey-Chrmel-1000010541326-7092021_01-2100.jpeg"
},
{
price: 699,
mrp: 999,
name: "MAX Men Solid Mandarin Collar Slim Fit Casual Shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000011487075-Blue-LIGHTBLUE-1000011487075-25072022_01-2100.jpg"
},
{
price: 699,
mrp: 999,
name: "MAX Men Solid Sleeveless T-shirt - Set of 2",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010541339-Black-Black-1000010541339-7092021_01-2100.jpg"
},
{
price: 359,
mrp: 699,
name: "MAX Men Printed Regular Fit Crew Neck Sports T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000011365982-Green-MINT-1000011365982-22062022_01-2100.jpg"
},
{
price: 759,
mrp: 1499,
name: "MAX Men Solid Crew Neck T-shirt - Set of 2",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010541313-Green-Oliveg-1000010541313-7092021_01-2100.jpg"
},
{
price: 559,
mrp: 799,
name: "MAX Men Solid Crew Neck T-shirt- Pack of 2",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010541352-Blue-Navy-1000010541352-7092021_01-2100.jpg"
},
{
price: 909,
mrp: 1299,
name: "MAX Men Freshon & Neudri Sleeveless T-shirt - Set of 2",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010541365-Green-Oliveg-1000010541365-7092021_01-2100.jpg"
},
{
price: 629,
mrp: 799,
name: "MAX Men Printed Crew Neck T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010577917-Blue-Skyblue-1000010577917-8132021_01-2100.jpg"
},
{
price: 859,
mrp: 1399,
name: "MAX Men Solid Mandarin Collar Slim Fit Casual Shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000011487075-Pink-PINK-1000011487075-25072022_01-2100.jpg"
},
{
price: 959,
mrp: 1399,
name: "MAX Men Printed Regular Fit Crew Neck Sports T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000011365982-Red-RED-1000011365982-22062022_01-2100.jpg"
},
{
price: 1859,
mrp: 1909,
name: "MAX Men Textured Regular Fit Crew Neck Sports T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000011365982-Black-BLACK-1000011365982-22062022_01-2100.jpg"
},
{
price: 359,
mrp: 799,
name: "MAX Men Printed Regular Fit Crew Neck Sports T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000011365982-Blue-NAVY-1000011365982-22062022_01-2100.jpg"
},
{
price: 1259,
mrp: 1599,
name: "MAX Men Solid Mandarin Collar Slim Fit Casual Shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000011487075-White-WHITE-1000011487075-25072022_01-2100.jpg"
},
{
price: 1759,
mrp: 1909,
name: "MAX Solid Slim Fit Polo T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000008731781-Grey-Gmelange-1000008731781-2112020_01-2100.jpg"
},
{
price: 750,
mrp: 1499,
name: "MAX Men Printed Regular Fit Polo T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010578030-Beige-Beige-1000010578030-8132021_01-2100.jpg"
},
{
price: 850,
mrp: 1699,
name: "MAX Men Striped Slim Fit Polo T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000008731781-Green-Green-1000008731781-2112020_01-2100.jpg"
},
{
price: 349,
mrp: 499,
name: "MAX Men Colourblock Regular Fit T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010577993-Red-Maroon-1000010577993-8132021_01-2100.jpg"
},
{
price: 699,
mrp: 999,
name: "MAX Men Printed Regular Fit Polo T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010577930-White-White-1000010577930-8132021_01-2100.jpg"
},
{
price: 699,
mrp: 999,
name: "MAX Men Printed Slim Fit Crew Neck T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010578030-Blue-Navy-1000010578030-8132021_01-2100.jpg"
},
{
price: 359,
mrp: 699,
name: "MAX Men Solid Slim Fit Polo T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010577955-White-White-1000010577955-8132021_01-2100.jpg"
},
{
price: 759,
mrp: 1499,
name: "MAX Solid Polo Slim Fit T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010533095-Blue-Navy-1000010533095-7092021_01-2100.jpg"
},
{
price: 559,
mrp: 799,
name: "MAX Men Striped Slim Fit Polo T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000008731720-Green-Darkgreen-1000008731720-1412020_01-2100.jpg"
},
{
price: 909,
mrp: 1299,
name: "MAX Men Solid Mandarin Collar Slim Fit Casual Shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010577993-Blue-Blue-1000010577993-8132021_01-2100.jpg"
},
{
price: 629,
mrp: 799,
name: "MAX Men Colourblock Regular Fit T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000011487075-Yellow-YELLOW-1000011487075-25072022_01-2100.jpg"
},
{
price: 859,
mrp: 1399,
name: "MAX Men Solid Slim Fit Casual Shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010577930-Blue-Blue-1000010577930-8132021_01-2100.jpg"
},
{
price: 559,
mrp: 799,
name: "MAX Men Solid Mandarin Collar Regular Fit Casual Shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000011487075-Black-BLACK-1000011487075-27062022_01-2100.jpg",
},
{
price: 559,
mrp: 799,
name: "MAX Solid Polo Slim Fit T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000008731781-Red-Maroon-1000008731781-2112020_01-2100.jpg",
},
{
price: 909,
mrp: 1299,
name: "MAX Solid Polo Slim Fit T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000008731720-Blue-Navy-1000008731720-1412020_01-2100.jpg"
},
{
price: 909,
mrp: 1299,
name: "MAX Men Solid Full Sleeves Casual Shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000011487075-Red-MAROON-1000011487075-31072022_01-2100.jpg"
},
{
price: 359,
mrp: 699,
name: "MAX Men Solid Slim Fit Polo T-shirt",
imagelink: "https://lmsin.net/cdn-cgi/image/h=345,w=345,q=60,fit=cover/https://aaeff43fe32172cbcecc-ae2a4e9a8cbc330ede5588dedf56886e.lmsin.net/max/1000010577955-White-White-1000010577955-8132021_01-2100.jpg"
},
];
// console.log(objArr)
display(objArr);
// no of produvts
let noofproducts = document.querySelector("#noofproducts");
let noofprod = document.querySelector("#noofprod");
noofprod.innerText = objArr.length;
noofproducts.innerText = objArr.length;
function display(data) {
document.querySelector("#cards-grid").innerHTML = null;
data.forEach(function (el) {
let cards = document.createElement("div");
let image = document.createElement("img");
image.setAttribute("src", el.imagelink);
// Heart sign
let heart = document.createElement("h3");
heart.setAttribute("id", "heart")
let heartsign = document.createElement("i");
heartsign.setAttribute("class", "fa-solid fa-heart-circle-plus");
heart.append(heartsign);
heart.addEventListener("click", function () {
heart.style.backgroundColor = "red"
})
// Online only
let onlineOnly = document.createElement("h5");
onlineOnly.setAttribute("id", "onlineOnly")
onlineOnly.innerText = "ONLINE ONLY";
// OFF
let off = document.createElement("h5");
off.setAttribute("id", "off")
off.innerText = "30% OFF";
let priceDiv = document.createElement("div")
let price = document.createElement("h3");
price.innerText = `₹${el.price}`;
let mrp = document.createElement("h4");
let strike = document.createElement("s");
strike.innerText = `₹${el.mrp}`;
mrp.append(strike)
priceDiv.append(price, mrp);
let name = document.createElement("p");
name.innerText = el.name;
// Button add to basket
let Button = document.createElement("button");
Button.setAttribute("class", "addtoBasket")
Button.innerText = "ADD TO BASKET"
// Button click to local storage to cart
Button.addEventListener("click", function () {
itemtoLocal(el);
});
cards.append(image, heart, onlineOnly, off, priceDiv, name, Button);
document.querySelector("#cards-grid").append(cards)
})
}
let cartItems = JSON.parse(localStorage.getItem("cartItems")) || [];
function itemtoLocal(el) {
cartItems.push(el);
localStorage.setItem("cartItems", JSON.stringify(cartItems));
}
// sticky navbar
window.onscroll = function () { myFunction() };
var navbar = document.getElementById("Navbar");
var sticky = Navbar.offsetTop;
function myFunction() {
if (window.pageYOffset >= sticky) {
navbar.classList.add("sticky")
} else {
navbar.classList.remove("sticky");
}
}
// Signup
let signup = document.getElementById("signup-click");
signup.addEventListener("click", signupFunc);
function signupFunc(el) {
el.preventDefault();
let SignupForm = document.querySelector("form");
SignupForm.setAttribute("id", "signup");
let Signuprem = document.querySelector("form");
Signuprem.style.display = "block"
}
let removesignup = document.getElementById("signupcut");
removesignup.addEventListener("click", signupRemFunc);
function signupRemFunc(el) {
el.preventDefault();
let Signuprem = document.querySelector("form");
Signuprem.style.display = "none"
console.log("rem")
}
// otp Page
let mobilenum = JSON.parse(localStorage.getItem("loginArr")) || [];
let form = document.querySelector("form");
form.addEventListener("submit", function (ele) {
ele.preventDefault();
let otppage = document.querySelector("#otppage");
otppage.style.display = "block"
let obj = {
mobile: form.mobile.value,
name: form.name.value,
};
mobilenum.push(obj);
localStorage.setItem("loginData", JSON.stringify(mobilenum));
})
// otp store
localStorage.setItem("otp", "1234");
// otppage remove
let removeotp = document.getElementById("otpcut");
removeotp.addEventListener("click", otpRemFunc);
function otpRemFunc(el) {
el.preventDefault();
let signup = document.querySelector(".form1");
let otppage = document.querySelector("#otppage");
otppage.style.display = "none";
signup.style.display = "none";
}
let otppage = document.querySelector("#otppage");
otppage.addEventListener("submit", verifyotp)
function verifyotp(el) {
el.preventDefault();
let otp = otppage.otp.value;
let localotp = JSON.parse(localStorage.getItem("otp"));
if (otp == localotp) {
alert("SIGN UP SUCCESFUL");
otppage.style.display = "none";
otppage.otp.value = "";
form.style.display = "none";
} else {
alert("WRONG OTP")
}
}
// HOMEPAGE REDIRECT
let homepage = document.querySelector("#homepageredirect");
homepage.addEventListener("click", function () {
window.location.href = "index.html";
})
// slider Functionality of Price
let selector = document.querySelector("#selector")
let slider = document.querySelector("#slider");
slider.addEventListener("change", function () {
selector.innerText = `₹100 - ₹${slider.value}`
let filteredarr = objArr.filter(function (el) {
return +el.price < slider.value;
})
noofproducts.innerText = filteredarr.length;
noofprod.innerText = filteredarr.length;
display(filteredarr)
})
// Filter by name
let productstype = document.querySelector("#productstype");
productstype.addEventListener("change", function () {
let filtername = objArr.filter(function (el) {
if (el.name.includes(productstype.value)) {
return el.name;
}
})
noofproducts.innerText = filtername.length;
noofprod.innerText = filtername.length;
display(filtername);
})
// Filter by Discount
let discountfilter = document.querySelector("#discountfilter");
discountfilter.addEventListener("change", discountFunc)
function discountFunc() {
let newdiscount = objArr.filter(function (el) {
return (+el.mrp - +el.price) < discountfilter.value
})
display(newdiscount)
noofproducts.innerText = newdiscount.length;
noofprod.innerText = newdiscount.length;
}
// relevancesort
let relevancesort = document.querySelector("#relevancesort");
relevancesort.addEventListener("change", relevancesortFunc);
function relevancesortFunc(){
if(relevancesort.value == "low"){
let lowtohigh = objArr.sort(function(a, b){
return a.price - b.price;
})
display(lowtohigh);
} else if(relevancesort.value == "high"){
let hightolow = objArr.sort(function(a, b){
return b.price - a.price;
})
display(hightolow);
} else{
display(objArr);
}
}