-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
700 lines (624 loc) · 26.8 KB
/
index.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
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
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
<!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>HEALTHPLUS</title>
<link rel="stylesheet" href="./style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css" integrity="sha512-YWzhKL2whUzgiheMoBFwW8CKV4qpHQAEuvilg9FAn5VJUDwKZZxkJNuGM4XkWuk94WCrrwslk8yWNGmY1EduTA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body>
<a href="./signup.html"></a>
<div id="container">
<div class="logo">
<img class="logo_img" src="./HEALTH PLUS (3).png" alt="">
</div>
<div id="search">
<input type="text" id="search-inp" placeholder="Search for productus & brands..."/>
<button id="search-btn">Search</button>
</div>
<a id="sign" href="./signup.html"><button onclick="document.getElementById('id02').style.display='block'" style="width:auto;margin-left: 30px;">Sign Up</button></a>
<div class="log">
<button onclick="document.getElementById('id01').style.display='block'" >Login</button>
<div id="id01" class="modal" >
<div class="modal-content animate" >
<div class="imgcontainer">
<span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">×</span>
</div>
<div id="card">
<div class="slideshow-container1">
<form class="mySlides fade">
<img id="imaages" src="https://static1.hkrtcdn.com/hknext/static/media/login/slider/1.svg" alt="" >
<div class="slide_inside">
<h4>Wide range of Original & Authentic Nutritional Products</h4>
<p>We strive to provide 100% authentic products to our customers</p>
</div>
</div>
<div class="verticalLine"></div>
<div class="container">
<div>
<img class="img_avatar" src="https://tse1.mm.bing.net/th?id=OIP.1qVutqafhdg1DyVSwcNJHQHaHa&pid=Api&rs=1&c=1&qlt=95&w=122&h=122" alt="">
</div>
<label for="uname"><b>Username</b></label>
<input type="text" placeholder="Enter Username" id="email" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" id="password" required>
<button type="submit">Submit</button>
<p>Already have an account</p> <a id="signup" href="./signup.html">Signup</a>
</form>
</div>
</div>
</div>
</div>
</div>
<a href="./addToCart.html"> <button id="addToCart"><span style="font-size:15px;color:white;text-decoration:none;background-color: #00b5b7;width:auto"></span>
Add To Cart</button></a>
</div>
<hr>
<div class="middle_part">
<select id="filter">
<option value="">Shop By Category</option>
<option value="Whey Proteins">Whey Proteins</option>
<option value="Mass Gainers">Mass Gainers</option>
<option value="Pre-Workout">Pre-Workout</option>
<option value="Whey Protein for Beginners">Whey Protein for Beginners</option>
<option value="Whey Protein Isolate">Whey Protein Isolate</option>
<option value="Oats">Oats</option>
<option value="Raw Whey Proteins">Raw Whey Proteins</option>
<option value="Creatine">Creatine</option>
<option value="Fish Oil">Fish Oil</option>
</select>
<div class="dropdown">
<button class="hover_txt">Best Sellers </button>
<div class="dropdown-content">
<a href="#">Sports Nutrition</a>
<a href="#">Health Nutrition</a>
<a href="#">Fitness</a>
<a href="#">Wellness</a>
</div>
</div>
<div class="hover_txt">Brands</div>
<div class="hover_txt"> Deals</div>
<div class="hover_txt"> Blogs</div>
<div class="hover_txt">Gift Card</div>
<select id="sortFilter">
<option value="">Sort</option>
<option value="Low to High">Low to High</option>
<option value="High to Low">High to Low</option>
</select>
<div class="dropdown">
<button class="hover_txt" >Customer Support </button>
<div class="dropdown-content">
<a href="#">Chat with us</a>
<a href="#">Ask our Experts</a>
<a href="#">Return policy</a>
<a href="#">FAQs</a>
<a href="#">Terms & Conditions</a>
<a href="#"><div class="address">
For Support & Order Enquiries
Call us at : 0124-4616444
10 AM to 7 PM</div></a>
</div>
</div>
<div class="hover_txt">Store Locator</div>
</div>
</section>
<div class="sent">
<div>India's Largest D2C Nutrition Platform</div>
</div>
<div id="medicine-container">
</div>
<div class="heading">
<h1>Price Slash Alert</h1>
</div>
<div class="cartImg">
<div class="division">
<img src="https://img5.hkrtcdn.com/19801/prd_1980004_c_s.jpg" alt="">
<div class="item">
<div class="star">4.5 <span style="font-size:125%;color:white;">★</span></div>
<div>HealthKart HK Vitals ACV 750 mg Effervescent, 15 tablet(s)...</div>
<div>₹ 299</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
<div class="division">
<img src="https://img9.hkrtcdn.com/24120/prd_2411908-HealthKart-HK-Vitals-ACV-750-mg-Effervescent-15-tablets-Watermelon_c_s.jpg" alt="">
<div class="item">
<div class="star">4.5 <span style="font-size:125%;color:white;">★</span></div>
<div>HealthKart HK Vitals ACV 750 mg Effervescent, 15 tablet(s)...</div>
<div>₹ 299</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
<div class="division">
<img src="https://img6.hkrtcdn.com/15130/prd_1512955-MuscleBlaze-Fish-Oil-1000-mg-OP-60-softgels_c_s.jpg" alt="">
<div class="item">
<div class="star">5.0 <span style="font-size:125%;color:white;">★</span></div>
<div>MuscleBlaze Fish Oil (1000 mg) OP, 60 softgels</div>
<div>₹ 399</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
<div class="division">
<img src="https://img1.hkrtcdn.com/23868/prd_2386710-MuscleBlaze-Super-Gainer-XXL-OP-old-6.6-lb-Chocolate_c_s.jpg" alt="">
<div class="item">
<div class="star">4.5 <span style="font-size:125%;color:white;">★</span></div>
<div>MuscleBlaze Super Gainer XXL OP old, 6.6 lb Chocolate</div>
<div>₹ 2,349</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
</div>
<div class="pic">
<div>
<img src="https://img9.hkrtcdn.com/24442/bnr_2444148_o.png" alt="">
</div>
<div>
<img src="https://img7.hkrtcdn.com/24444/bnr_2444326_o.jpg" alt="">
</div>
<div>
<img src="https://img1.hkrtcdn.com/24442/bnr_2444150_o.jpg" alt="">
</div>
<div>
<img src="https://img5.hkrtcdn.com/24442/bnr_2444154_o.jpg" alt="">
</div>
</div>
<div class="heading">
<h1>Top Deals</h1>
</div >
<div class="cartImg">
<div class="division">
<img src="https://img2.hkrtcdn.com/13488/prd_1348781-MB-Fuel-One-Whey-Protein-Immunity-2.2-lb-Chocolate_c_s.jpg" alt="">
<div class="item">
<div class="star">4.5 <span style="font-size:125%;color:white;">★</span></div>
<div>MB Fuel One Whey Protein Immunity+, 2.2 lb Chocolate </div>
<div>₹ 299</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
<div class="division">
<img src="https://img10.hkrtcdn.com/10610/prd_1060999-MuscleBlaze-Pre-Workout-Ripped-0.55-lb-Raspberry-Lemonade_c_s.jpg" alt="">
<div class="item">
<div class="star">4.5 <span style="font-size:125%;color:white;">★</span></div>
<div>MuscleBlaze Pre Workout Ripped, Raspberry Lemonade </div>
<div>₹ 299</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
<div class="division">
<img src="https://img1.hkrtcdn.com/19939/prd_1993850-MuscleBlaze-Fish-Oil-1000-mg-Indias-Only-Labdoor-USA-Certified-for-Purity-Accuracy-60-softgels_c_s.jpg" alt="">
<div class="item">
<div class="star">5.0 <span style="font-size:125%;color:white;">★</span></div>
<div>MuscleBlaze Fish Oil (1000 mg) </div>
<div>₹ 399</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
<div class="division">
<img src="https://img1.hkrtcdn.com/21447/prd_2144620-MuscleBlaze-High-Protein-Oats-2-kg-Dark-Chocolate_c_s.jpg" alt="">
<div class="item">
<div class="star">4.5 <span style="font-size:125%;color:white;">★</span></div>
<div>MuscleBlaze High Protein Oats, 2 kg Dark Chocolate </div>
<div>₹ 2,349</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
</div>
<div class="heading1">
<h1>Top Selling Combos</h1>
</div>
<div class="pic">
<div>
<img src="https://img9.hkrtcdn.com/24441/bnr_2444088_o.jpg" alt="">
</div>
<div>
<img src="https://img1.hkrtcdn.com/24441/bnr_2444090_o.jpg" alt="">
</div>
<div>
<img src="https://img1.hkrtcdn.com/24442/bnr_2444190_o.jpg" alt="">
</div>
<div>
<img src="https://img3.hkrtcdn.com/24442/bnr_2444192_o.jpg" alt="">
</div>
</div>
<div class="heading">
<h1>Fit Food Range</h1>
</div>
<div class="cartImg">
<div class="division">
<img src="https://img1.hkrtcdn.com/19873/prd_1987230-MuscleBlaze-High-Protein-Peanut-Butter-1-kg-Dark-Chocolate-Creamy-Tub_c_s.jpg" alt="">
<div class="item">
<div class="star">4.5 <span style="font-size:125%;color:white;">★</span></div>
<div>MuscleBlaze High Protein Peanut Butter, 1 kg Dark Chocolate Creamy </div>
<div>₹ 299</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
<div class="division">
<img src="https://img5.hkrtcdn.com/22414/prd_2241304-MuscleBlaze-High-Protein-Muesli-1-kg-Dark-Chocolate-Cranberry_c_s.jpg" alt="">
<div class="item">
<div class="star">4.5 <span style="font-size:125%;color:white;">★</span></div>
<div>MuscleBlaze High Protein Muesli, 1 kg Dark Chocolate & Cranberry </div>
<div>₹ 299</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
<div class="division">
<img src="https://img1.hkrtcdn.com/21374/prd_2137310-Myfitness-Chocolate-Peanut-Butter-1.25-kg-Smooth_c_s.jpg" alt="">
<div class="item">
<div class="star">5.0 <span style="font-size:125%;color:white;">★</span></div>
<div>Myfitness Chocolate Peanut Butter, 1.2 kg Smooth </div>
<div>₹ 399</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
<div class="division">
<img src="https://img1.hkrtcdn.com/22302/prd_2230120-MuscleBlaze-High-Protein-Oats-1-kg-Dark-Chocolate_c_s.jpg" alt="">
<div class="item">
<div class="star">4.5 <span style="font-size:125%;color:white;">★</span></div>
<div>MuscleBlaze High Protein Oats, 1 kg Dark Chocolate </div>
<div>₹ 2,349</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
</div>
<div class="heading1">
<h1>Shop More Save More</h1>
</div>
<div class="pic">
<div>
<img src="https://img7.hkrtcdn.com/24452/bnr_2445136_o.png" alt="">
</div>
<div>
<img src="https://img9.hkrtcdn.com/24452/bnr_2445138_o.jpg" alt="">
</div>
<div>
<img src="https://img1.hkrtcdn.com/24452/bnr_2445140_o.png" alt="">
</div>
<div>
<img src="https://img3.hkrtcdn.com/24452/bnr_2445142_o.jpg" alt="">
</div>
</div>
<div class="heading">
<h1>Workout Essentials</h1>
</div>
<div class="cartImg">
<div class="division">
<img src="https://img9.hkrtcdn.com/16134/prd_1613308-ON-Optimum-Nutrition-Micronized-Creatine-Powder-Unflavoured-0.55-lb_c_s.jpg" alt="">
<div class="item">
<div class="star">4.5 <span style="font-size:125%;color:white;">★</span></div>
<div>ON (Optimum Nutrition) Micronized Creatine Powder, Unflavoured 0.55 lb </div>
<div>₹ 299</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
<div class="division">
<img src="https://img6.hkrtcdn.com/12181/prd_1218085-GNC-Creatine-Monohydrate-Unflavoured-0.55-lb_c_s.jpg" alt="">
<div class="item">
<div class="star">4.5 <span style="font-size:125%;color:white;">★</span></div>
<div>GNC Creatine Monohydrate, Unflavoured 0.55 lb </div>
<div>₹ 299</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
<div class="division">
<img src="https://img7.hkrtcdn.com/23006/prd_2300596-MuscleTech-Platinum-100-Creatine-Unflavoured-0.88-lb_c_s.jpg" alt="">
<div class="item">
<div class="star">5.0 <span style="font-size:125%;color:white;">★</span></div>
<div>MuscleTech Platinum 100% Creatine, Unflavoured 0.88 lb </div>
<div>₹ 399</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
<div class="division">
<img src="https://img8.hkrtcdn.com/13068/prd_1306707-Cellucor-C4-Explosive-Preworkout-0.85-lb-Watermelon_c_s.jpg" alt="">
<div class="item">
<div class="star">4.5 <span style="font-size:125%;color:white;">★</span></div>
<div>Cellucor C4 Explosive Preworkout, 0.85 lb Watermelon </div>
<div>₹ 2,349</div>
<button id="addtocart">Add to Cart</button>
</div>
</div>
</div>
<div id="brand">
<h1>Brand Range</h1>
<div class="brand_pg">
<div>
<img src="https://img3.hkrtcdn.com/22115/bnr_2211472_o.png" alt="">
</div>
<div>
<img src="https://img7.hkrtcdn.com/22043/normal_2204256_o.png" alt="">
</div>
<div>
<img src="https://img9.hkrtcdn.com/22043/normal_2204258_o.png" alt="">
</div>
<div>
<img src="https://img1.hkrtcdn.com/22043/normal_2204260_o.png" alt="">
</div>
<div>
<img src="https://img9.hkrtcdn.com/22101/bnr_2210088_o.png" alt="">
</div>
<div>
<img src="https://img1.hkrtcdn.com/22099/bnr_2209880_o.png" alt="">
</div>
<div>
<img src="https://img7.hkrtcdn.com/22043/normal_2204266_o.png" alt="">
</div>
<div>
<img src="https://img1.hkrtcdn.com/22043/normal_2204270_o.png" alt="">
</div>
</div>
</div>
<div class="health-heading">
<h1 class="headings">Why Health Plus ?</h1>
<div class="healthPlus">
<div>
<img src="https://img9.hkrtcdn.com/20791/normal_2079088_o.png" alt="">
<h4>Wide range of Nutritional products</h4>
<p>One-stop fitness and health destination</p>
</div>
<div>
<img src="https://img3.hkrtcdn.com/20791/normal_2079092_o.png" alt="">
<h4>100% Original & Authentic</h4>
<p>Tight control on sourcing and distribution</p>
</div>
<div>
<img src="https://img1.hkrtcdn.com/20791/normal_2079090_o.png" alt="">
<h4>Guide to Fit and Healthy Lifestyle</h4>
<p>Your true partner in health & wellness journey</p>
</div>
</div>
</div>
<div id="footer">
<img class="logo_image" src="./HEALTH PLUS (3).png" alt="">
<div class="foot">
<div class="foot-full">
<div class="footer_part">
<div class="footer-col brands">
<ul> <li class="footer-heading">Health Plus</li></ul>
<ul>
<li>About Us</li>
<li>Contact Us</li>
<li>Refer & Earn</li>
<li>Loyalty Program </li>
<li>Blogs, Videos & More </li>
<li>Brand Directory </li>
<li>Authenticity Guaranteed </li>
<li>Careers </li>
</ul>
</div>
<div class="footer-col brands">
<ul><li class="footer-heading">Brands</li></ul>
<ul>
<li>MuscleBlaze</li>
<li>Fit Foods</li>
<li>HK Vitals</li>
<li>TrueBasics</li>
<li>Gritzo</li>
<li>bGREEN</li>
</ul>
</div>
<div class="footer-col brands">
<ul><li class="footer-heading">Health & Fitness</li></ul>
<ul>
<li>Hair & Skin Care</li>
<li>Sports Nutrition</li>
<li>Vitamins & Supplements</li>
<li>Ayurveda & Herbs</li>
<li>Health Food & Drinks</li>
<li>Fitness</li>
<li>Wellness</li>
</ul>
</div>
<div class="footer-col brands">
<ul> <li class="footer-heading">Quick links</li></ul>
<ul>
<li>My Account</li>
<li>Track Your Order</li>
<li>Store Locator</li>
<li>HK Cash</li>
<li>HK Coupons</li>
<li>FAQs</li>
<li>Sell On HealthKart</li>
</ul>
</div>
<div class="footer-col brands">
<ul><li class="footer-heading">Contact Us</li></ul>
<ul>
<li class="contact-item flex">care@healthkart.com</li>
<li class="contact-item flex">0124-4616444</li>
<li class="contact-item flex">
The Presidency Tower, Tower-B, 2nd Floor, 46/4, Mehrauli Rd opp. government girls college, Anamika Enclave, Sector 14, Gurugram, Haryana</li>
</ul>
</div>
</div>
</div>
<div id="subscribe">
<div>
<h4 style="padding-left: 20px;">Subscribe</h4>
<input type="email" id="mailid" placeholder="Enter mail">
<p style="padding-left: 20px;"><span style="color:red;">*</span>Get newsletters and exclusive offers</p>
</div>
<div class="googleApp1">
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/Return.png" alt="">
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/authenticity.png" alt="">
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/secure.png" alt="">
</div>
<p style="padding-left: 20px;">Follow Us On</p>
<div class="follow">
<div>
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/facebook-new.svg" alt="">
</div>
<div>
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/Instagram-new.svg" alt="">
</div>
<div>
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/LinkedIn-new.svg" alt="">
</div>
<div>
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/Youtube-new.svg" alt="">
</div>
<div>
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/twitter-new.svg" alt="">
</div>
<div>
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/pinterest-icon.svg" alt="">
</div>
</div>
<p style="padding-left: 20px;margin-top: 20px;">Download Our App</p>
<div class="googleApp">
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/google-badge.svg" alt="">
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/app-store-new.svg" alt="">
</div>
</div>
</div>
<div class="footer_img">
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/pay1.svg" alt="">
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/pay2.svg" alt="">
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/pay3.svg" alt="">
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/pay4.svg" alt="">
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/pay5.svg" alt="">
<img src="https://static1.hkrtcdn.com/hknext/static/media/common/footer/pay6.svg" alt="">
</div>
<br>
<div class="terms">
<hr>
<div class="copyright">
<div>Copyright © 2023,HealthKart.com, or its affiliates</div>
<div>Terms & Conditions | Delivery Policy | Privacy Policy | Disclaime | Returns Policy</div>
</div>
</div>
</div>
</body>
</html>
<script src="./index.js"></script>
<script>
let medicineApiResult;
async function fetchData(){
try{
let res=await fetch("https://kblessmi2001.github.io/medicine_data/data.json")
res= await res.json()
medicineApiResult=res.medicine;
localStorage.setItem("medicineApiResult",JSON.stringify(medicineApiResult))
displayData(res.medicine)
// console.log(res.medicine)
}
catch(err){
console.log("error",err)
}
}
fetchData()
medicineApiResult=JSON.parse(localStorage.getItem("medicineApiResult")) || []
let container=document.getElementById("medicine-container")
let searchButton=document.getElementById("search-btn")
searchButton.addEventListener("click",()=>{
let searchInput=document.getElementById("search-inp").value
let filteredSearchResult=medicineApiResult.filter((ele)=>ele.name.includes(searchInput))
if(filteredSearchResult)
{
document.getElementById("search-inp").value=""
displayData(filteredSearchResult)
}
else{
alert("No result")
document.getElementById("search-inp").value=""
}
})
let MedicineCart=JSON.parse(localStorage.getItem("medicine")) || []
function displayData(data)
{
container.innerHTML=""
data.forEach((medi) => {
let medicineContainer=document.createElement("div")
let category=document.createElement("h4")
category.className +="cate"
let rating=document.createElement("h5")
rating.className +="rating"
let discount=document.createElement("h5")
discount.className += "count"
let id=document.createElement("p")
let image=document.createElement("img")
image.className+="image"
let name=document.createElement("h2")
name.className +="nameEl"
let price=document.createElement("h4")
price.className+="price"
let addtocart=document.createElement("button")
addtocart.className+="addToCart"
let wishlist=document.createElement("button")
category.innerText=medi.category;
rating.innerText=`${medi.rating} ★`;
id.innerText=medi.id;
image.src=medi.image;
name.innerText=medi.name;
price.innerText=`₹${medi.price}`;
addtocart.innerText="Add To Cart";
discount.innerText="Discount: " + `${medi.discount}%`
wishlist.textConteht="Wishlist"
addtocart.addEventListener("click",()=>
{
if(checkDuplicate(medi))
{
alert("Already Added To Cart")
}
else{
MedicineCart.push({...medi})
localStorage.setItem("medicine",JSON.stringify(MedicineCart))
alert("Successfully added")
}
})
medicineContainer.append(image,rating,name,discount,price,category,addtocart)
container.append(medicineContainer)
});
}
function checkDuplicate(medi)
{
for(let i=0;i<MedicineCart.length;i++)
{
if(MedicineCart[i].id==medi.id){
return true
}
}
return false
}
medicineApiResult=JSON.parse(localStorage.getItem("medicineApiResult")) || []
let sortPriceDropDown=document.getElementById("sortFilter")
sortPriceDropDown.addEventListener("change",function()
{
let sortPrice= document.getElementById('sortFilter').selectedOptions[0].value;
if(sortPrice=="")
{
displayData( totalApiResult)
}
if(sortPrice=="High to Low"){
let sortPriceEle=medicineApiResult.sort(function(a,b){
return b.price-a.price;
})
displayData(sortPriceEle)
}
if(sortPrice=="Low to High"){
let sortPriceEle=medicineApiResult.sort(function(a,b){
return a.price-b.price
})
// console.log(sortPriceEle)
displayData(sortPriceEle)
}
})
let totalApiResult=JSON.parse(localStorage.getItem("medicineApiResult")) || []
let filterByDropDown=document.getElementById("filter")
filterByDropDown.addEventListener("change",()=>{
let selectedOption= document.getElementById('filter').selectedOptions[0].value;
if(selectedOption=="")
{
displayData(totalApiResult)
}
else{
let filtered= totalApiResult.filter((ele)=>ele.category==selectedOption)
if(filtered)
{
displayData(filtered)
}
}
})
</script>