-
Notifications
You must be signed in to change notification settings - Fork 4
/
product.html
915 lines (785 loc) · 27.4 KB
/
product.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
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Products | Aavaran</title>
<link rel="icon" type="image/x-icon" href="logoo.jpeg">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--primary-color: #4CAF50;
--secondary-color: #45a049;
--accent-color: #8bc34a;
--text-color: #333;
--background-color: #f4f4f4;
--card-background: white;
}
.dark-mode {
--primary-color: #388E3C;
--secondary-color: #2E7D32;
--accent-color: #689F38;
--text-color: #f4f4f4;
--background-color: #333;
--card-background: #444;
}
body {
font-family: 'Poppins', Arial, sans-serif;
line-height: 1.6;
color: var(--text-color);
background-color: var(--background-color);
transition: background-color 0.3s, color 0.3s;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
.header {
background-color: #ffffff;
padding: 20px 50px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
}
.logo a {
font-family: 'Arial', sans-serif;
color: #00796b;
text-decoration: none;
font-size: 2em;
font-weight: bold;
}
.nav-links {
list-style: none;
display: flex;
gap: 30px;
}
.nav-links li {
display: inline-block;
}
.nav-links a {
color: #00796b;
text-decoration: none;
font-size: 1.1em;
padding: 10px 20px;
transition: background 0.3s ease;
}
.nav-links a:hover,
.nav-links .active {
background-color: #e0f2f1;
border-radius: 20px;
}
.hamburger {
display: none;
cursor: pointer;
background: none;
margin-left: auto;
border: none;
font-size: 1.5rem;
}
.hero {
position: relative;
height: 600px;
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://images.unsplash.com/photo-1542601906990-b4d3fb778b09?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2213&q=80');
background-size: cover;
background-position: center;
display: flex;
align-items: center;
justify-content: center;
}
.hero-content {
text-align: center;
color: white;
max-width: 800px;
padding: 2rem;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.hero h1 {
font-size: 3.5rem;
margin-bottom: 1rem;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
.hero p {
font-size: 1.4rem;
margin-bottom: 2rem;
}
.cta-button {
display: inline-block;
background-color: var(--accent-color);
color: white;
padding: 1rem 2rem;
border-radius: 50px;
text-decoration: none;
font-weight: bold;
transition: background-color 0.3s, transform 0.3s;
}
.cta-button:hover {
background-color: #7CB342;
transform: translateY(-3px);
}
.dynamic-banner {
background-color: var(--accent-color);
color: white;
text-align: center;
padding: 1rem;
font-weight: bold;
font-size: 1.2rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
main {
padding: 2rem 0;
}
.section-title {
text-align: center;
margin-bottom: 2rem;
color: var(--primary-color);
font-size: 2.5rem;
font-weight: 700;
position: relative;
padding-bottom: 1rem;
}
.section-title::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 100px;
height: 4px;
background-color: var(--accent-color);
}
.search-filter {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
}
.search-bar {
flex: 1;
margin-right: 1rem;
position: relative;
}
.search-bar input {
width: 100%;
padding: 0.5rem 2.5rem 0.5rem 0.5rem;
border: 1px solid var(--primary-color);
border-radius: 5px;
}
.search-icon {
position: absolute;
right: 10px;
top: 50%;
transform: translateY(-50%);
color: var(--primary-color);
cursor: pointer;
}
.filters {
display: flex;
gap: 1rem;
}
.filter-btn {
background-color: var(--primary-color);
color: white;
border: none;
padding: 0.5rem 1rem;
cursor: pointer;
border-radius: 25px;
transition: background-color 0.3s, transform 0.3s;
}
.filter-btn:hover {
background-color: var(--secondary-color);
transform: translateY(-2px);
}
.products {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 2rem;
}
.product-card {
background-color: var(--card-background);
border-radius: 15px;
overflow: hidden;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: transform 0.3s, box-shadow 0.3s;
display: flex;
flex-direction: column;
}
.product-card:hover {
transform: translateY(-10px);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}
.product-image {
width: 100%;
height: 250px;
object-fit: cover;
transition: transform 0.3s;
}
.product-card:hover .product-image {
transform: scale(1.05);
}
.product-info {
padding: 1.5rem;
flex-grow: 1;
display: flex;
flex-direction: column;
}
.product-title {
font-size: 1.4rem;
margin-bottom: 0.5rem;
color: var(--primary-color);
}
.product-description {
font-size: 1rem;
color: var(--text-color);
margin-bottom: 1rem;
flex-grow: 1;
}
.product-price {
font-weight: bold;
color: var(--accent-color);
font-size: 1.2rem;
margin-bottom: 1rem;
}
.product-actions {
display: flex;
justify-content: space-between;
}
.add-to-cart, .quick-view {
flex: 1;
padding: 0.8rem;
border: none;
border-radius: 5px;
cursor: pointer;
font-weight: bold;
transition: background-color 0.3s, transform 0.3s;
}
.add-to-cart {
background-color: var(--primary-color);
color: white;
margin-right: 0.5rem;
}
.quick-view {
background-color: var(--secondary-color);
color: white;
margin-left: 0.5rem;
}
.add-to-cart:hover, .quick-view:hover {
transform: scale(1.05);
}
footer {
background-color: var(--primary-color);
color: white;
text-align: center;
padding: 2rem 0;
margin-top: 2rem;
}
.impact-statement {
font-size: 1.2rem;
margin-bottom: 1rem;
}
.social-proof {
font-style: italic;
}
.dark-mode-toggle {
background: none;
border: none;
color: white;
font-size: 1.5rem;
cursor: pointer;
transition: color 0.3s;
}
.dark-mode-toggle:hover {
color: var(--secondary-color);
}
.modal {
display: none;
position: fixed;
z-index: 1001;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
overflow-y: auto;
}
.modal-content {
background-color: var(--card-background);
margin: 5% auto;
padding: 20px;
border-radius: 10px;
max-width: 600px;
width: 90%;
position: relative;
}
.close-modal {
position: absolute;
right: 10px;
top: 10px;
font-size: 1.5rem;
cursor: pointer;
}
.impact-metrics {
display: flex;
justify-content: space-around;
margin-top: 1rem;
}
.impact-metric {
text-align: center;
}
.impact-metric-value {
font-size: 1.5rem;
font-weight: bold;
color: var(--accent-color);
}
.pagination {
display: flex;
justify-content: center;
margin-top: 2rem;
}
.pagination button {
background-color: var(--primary-color);
color: white;
border: none;
padding: 0.5rem 1rem;
margin: 0 0.5rem;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s;
}
.pagination button:hover {
background-color: var(--secondary-color);
}
.pagination button:disabled {
background-color: #ccc;
cursor: not-allowed;
}
.wishlist-btn {
background: none;
border: none;
color: #ff4081;
font-size: 1.5rem;
cursor: pointer;
transition: transform 0.3s;
}
.wishlist-btn:hover {
transform: scale(1.1);
}
@media (max-width: 768px) {
.header {
padding: 20px;
}
.hamburger {
display: block;
}
.nav-links {
display: none;
flex-direction: column;
position: absolute;
top: 80px;
left: 0;
width: 100%;
background-color: #ffffff;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
z-index: 1000;
}
.nav-links.show {
display: flex;
}
.nav-links li {
width: 100%;
text-align: center;
}
.nav-links a {
display: block;
padding: 15px;
}
.products {
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.hero {
height: auto;
min-height: 300px;
}
.hero-content {
padding: 2rem 1rem;
}
.hero h1 {
font-size: 2rem;
}
.hero p {
font-size: 1rem;
}
.search-filter {
flex-direction: column;
align-items: stretch;
}
.search-bar {
margin-right: 0;
margin-bottom: 1rem;
}
.filters {
flex-wrap: wrap;
justify-content: center;
}
.filter-btn {
margin-bottom: 0.5rem;
}
}
@media (max-width: 480px) {
.hero h1 {
font-size: 1.5rem;
}
.hero p {
font-size: 0.9rem;
}
.cta-button {
padding: 0.8rem 1.5rem;
font-size: 0.9rem;
}
.section-title {
font-size: 2rem;
}
.product-card {
width: 100%;
}
}
</style>
</head>
<body>
<header>
<nav class="navbar">
<div class="logo">
<a href="index.html">Aavaran</a>
</div>
<button class="hamburger" id="hamburger">☰</button>
<ul class="nav-links" id="nav-links">
<li><a href="index.html">Home</a></li>
<li><a href="product.html">Products</a></li>
<li><a href="alternatives.html">Alternatives</a></li>
<li><a href="blog.html">Blog</a></li>
<li><a href="community.html">Community</a></li>
<li><a href="register.html">My Account</a></li>
</ul>
<button class="dark-mode-toggle" id="darkModeToggle">🌓</button>
</nav>
</header>
<section class="hero">
<div class="hero-content">
<h1>Sustainable Living Starts Here</h1>
<p>Discover eco-friendly products that make a difference for you and the planet</p>
<a href="#products-container" class="cta-button">Shop Now</a>
</div>
</section>
<div class="dynamic-banner" id="dynamicBanner">
New Arrivals: Check out our latest sustainable products!
</div>
<main class="container">
<h2 class="section-title">Our Sustainable Products</h2>
<div class="search-filter">
<div class="search-bar">
<input type="text" id="searchInput" placeholder="Search products...">
<span class="search-icon" id="searchButton">🔍</span>
</div>
<div class="filters">
<button class="filter-btn active" data-category="all">All</button>
<button class="filter-btn" data-category="home">Home</button>
<button class="filter-btn" data-category="personal">Personal Care</button>
<button class="filter-btn" data-category="kitchen">Kitchen</button>
</div>
</div>
<div class="products" id="products-container">
</div>
<div class="pagination">
<button id="prevPage">Previous</button>
<span id="currentPage"></span>
<button id="nextPage">Next</button>
</div>
</main>
<footer>
<div class="container">
<p class="impact-statement">Together, we can save 10,000kg of plastic and reduce 5,000kg of CO2 emissions!</p>
<p class="social-proof">Join us and together we can make a difference with Aavaran</p>
<p>© 2024 Aavaran. All rights reserved.</p>
</div>
</footer>
<div id="quickViewModal" class="modal">
<div class="modal-content">
<span class="close-modal">×</span>
<div id="modalContent"></div>
</div>
</div>
<script>
const products = [
{
id: 1,
name: "Bamboo Toothbrush",
description: "Eco-friendly alternative to plastic toothbrushes",
price: 50,
image: "https://images.unsplash.com/photo-1607613009820-a29f7bb81c04?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1740&q=80",
category: "personal",
impact: {
plasticSaved: "5g",
co2Reduced: "10g"
}
},
{
id: 2,
name: "Reusable Water Bottle",
description: "Durable and stylish alternative to single-use plastics",
price: 350,
image: "https://images.unsplash.com/photo-1602143407151-7111542de6e8?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=687&q=80",
category: "personal",
impact: {
plasticSaved: "100g",
co2Reduced: "50g"
}
},
{
id: 3,
name: "Organic Cotton Tote",
description: "Versatile and eco-friendly shopping companion",
price: 100,
image: "https://cdn.pixabay.com/photo/2019/07/26/11/33/bag-4364558_1280.jpg",
category: "home",
impact: {
plasticSaved: "50g",
co2Reduced: "30g"
}
},
{
id: 4,
name: "Beeswax Food Wraps",
description: "Reusable alternative to plastic wrap",
price: 150,
image: "https://i.pinimg.com/originals/be/64/ac/be64ac6af0287df039071bf2a5ccfb16.jpg",
category: "kitchen",
impact: {
plasticSaved: "30g",
co2Reduced: "20g"
}
},
{
id: 5,
name: "Stainless Steel Straws",
description: "Durable and washable alternative to plastic straws",
price: 50,
image: "https://plus.unsplash.com/premium_photo-1664007549590-6e5bdaf02c15?q=80&w=1887&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
category: "kitchen",
impact: {
plasticSaved: "20g",
co2Reduced: "15g"
}
},
{
id: 6,
name: "Biodegradable Phone Case",
description: "Protect your phone and the environment",
price: 100,
image: "https://images.unsplash.com/photo-1603313011101-320f26a4f6f6?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1740&q=80",
category: "personal",
impact: {
plasticSaved: "40g",
co2Reduced: "25g"
}
},
{
id: 7,
name: "Compostable Cutlery Set",
description: "Eco-friendly utensils for on-the-go meals",
price: 75,
image: "https://plus.unsplash.com/premium_photo-1661431012847-4042319febcb?q=80&w=1774&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
category: "kitchen",
impact: {
plasticSaved: "25g",
co2Reduced: "18g"
}
},
{
id: 8,
name: "Reusable Produce Bags",
description: "Mesh bags for plastic-free grocery shopping",
price: 80,
image: "https://images.unsplash.com/photo-1628752660419-ad1c751abe72?q=80&w=1887&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
category: "home",
impact: {
plasticSaved: "35g",
co2Reduced: "22g"
}
},
{
id: 9,
name: "Solar-Powered Lantern",
description: "Sustainable lighting for outdoor adventures",
price: 200,
image: "https://images.unsplash.com/photo-1515940175183-6798529cb860?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1471&q=80",
category: "home",
impact: {
plasticSaved: "60g",
co2Reduced: "100g"
}
},
{
id: 10,
name: "Recycled Notebook",
description: "Stylish notebook made from recycled materials",
price: 60,
image: "https://images.unsplash.com/photo-1531346878377-a5be20888e57?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=687&q=80",
category: "home",
impact: {
plasticSaved: "15g",
co2Reduced: "30g"
}
}
];
const productsContainer = document.getElementById('products-container');
const filterButtons = document.querySelectorAll('.filter-btn');
const darkModeToggle = document.getElementById('darkModeToggle');
const modal = document.getElementById('quickViewModal');
const modalContent = document.getElementById('modalContent');
const closeModal = document.querySelector('.close-modal');
const dynamicBanner = document.getElementById('dynamicBanner');
const searchInput = document.getElementById('searchInput');
const searchButton = document.getElementById('searchButton');
const hamburger = document.getElementById('hamburger');
const navLinks = document.getElementById('nav-links');
const prevPageBtn = document.getElementById('prevPage');
const nextPageBtn = document.getElementById('nextPage');
const currentPageSpan = document.getElementById('currentPage');
let currentPage = 1;
const itemsPerPage = 8;
let filteredProducts = products;
function createProductCard(product) {
const card = document.createElement('div');
card.classList.add('product-card');
card.innerHTML = `
<img src="${product.image}" alt="${product.name}" class="product-image">
<div class="product-info">
<h3 class="product-title">${product.name}</h3>
<p class="product-description">${product.description}</p>
<p class="product-price">₹${product.price.toFixed(2)}</p>
<div class="product-actions">
<button class="add-to-cart">Add to Cart</button>
<button class="quick-view" data-id="${product.id}">Quick View</button>
</div>
</div>
`;
return card;
}
function displayProducts(page = 1) {
productsContainer.innerHTML = '';
const start = (page - 1) * itemsPerPage;
const end = start + itemsPerPage;
const paginatedProducts = filteredProducts.slice(start, end);
paginatedProducts.forEach(product => {
const card = createProductCard(product);
productsContainer.appendChild(card);
});
updatePagination();
}
function updatePagination() {
const totalPages = Math.ceil(filteredProducts.length / itemsPerPage);
currentPageSpan.textContent = `Page ${currentPage} of ${totalPages}`;
prevPageBtn.disabled = currentPage === 1;
nextPageBtn.disabled = currentPage === totalPages || totalPages === 0;
}
function filterProducts(category = 'all', searchTerm = '') {
filteredProducts = products.filter(product =>
(category === 'all' || product.category === category) &&
(product.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
product.description.toLowerCase().includes(searchTerm.toLowerCase()))
);
currentPage = 1;
displayProducts(currentPage);
}
filterButtons.forEach(button => {
button.addEventListener('click', () => {
const category = button.getAttribute('data-category');
filterProducts(category, searchInput.value);
filterButtons.forEach(btn => btn.classList.remove('active'));
button.classList.add('active');
});
});
function performSearch() {
const activeCategory = document.querySelector('.filter-btn.active').getAttribute('data-category');
filterProducts(activeCategory, searchInput.value);
}
searchInput.addEventListener('input', performSearch);
searchButton.addEventListener('click', performSearch);
darkModeToggle.addEventListener('click', () => {
document.body.classList.toggle('dark-mode');
});
productsContainer.addEventListener('click', (e) => {
if (e.target.classList.contains('quick-view')) {
const productId = parseInt(e.target.getAttribute('data-id'));
const product = products.find(p => p.id === productId);
modalContent.innerHTML = `
<h2>${product.name}</h2>
<img src="${product.image}" alt="${product.name}" style="max-width: 100%; max-height: 300px; object-fit: cover;">
<p>${product.description}</p>
<p>Price: ₹${product.price.toFixed(2)}</p>
<div class="impact-metrics">
<div class="impact-metric">
<div class="impact-metric-value">${product.impact.plasticSaved}</div>
<div>Plastic Saved</div>
</div>
<div class="impact-metric">
<div class="impact-metric-value">${product.impact.co2Reduced}</div>
<div>CO2 Reduced</div>
</div>
</div>
<button class="add-to-cart">Add to Cart</button>
`;
modal.style.display = 'block';
}
});
closeModal.addEventListener('click', () => {
modal.style.display = 'none';
});
window.addEventListener('click', (e) => {
if (e.target === modal) {
modal.style.display = 'none';
}
});
const bannerMessages = [
"New Arrivals: Check out our latest sustainable products!",
"Free shipping on orders over ₹1000!",
"Join our loyalty program and earn eco-points with every purchase!",
"Subscribe to our newsletter for exclusive deals and eco-tips!"
];
let currentBannerIndex = 0;
function rotateBanner() {
dynamicBanner.textContent = bannerMessages[currentBannerIndex];
currentBannerIndex = (currentBannerIndex + 1) % bannerMessages.length;
}
setInterval(rotateBanner, 5000);
hamburger.addEventListener('click', () => {
navLinks.classList.toggle('show');
});
prevPageBtn.addEventListener('click', () => {
if (currentPage > 1) {
currentPage--;
displayProducts(currentPage);
}
});
nextPageBtn.addEventListener('click', () => {
const totalPages = Math.ceil(filteredProducts.length / itemsPerPage);
if (currentPage < totalPages) {
currentPage++;
displayProducts(currentPage);
}
});
document.addEventListener('DOMContentLoaded', () => {
displayProducts(1);
filterProducts();
});
</script>
</body>
</html>