-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestcarousel.html
683 lines (637 loc) · 30.2 KB
/
testcarousel.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Carousel Repair</title>
<script src="https://cdn.tailwindcss.com" defer></script>
<style>
/* Optional: style for the .prose in the modal. */
.prose ul {
list-style-type: disc;
margin-left: 1.5rem;
}
.prose h4 {
margin-top: 1rem;
font-weight: bold;
}
</style>
</head>
<body class="bg-gray-100">
<!-- Carousel Container -->
<div class="relative h-screen w-full overflow-hidden">
<!-- Slides Wrapper -->
<div class="carousel-container h-full w-full touch-pan-y relative">
<!-- Slide 1: Water Solutions -->
<div class="absolute inset-0 transition-opacity duration-700 flex flex-col md:flex-row items-center justify-center p-4 md:p-8 bg-gradient-to-br from-blue-600 to-cyan-500">
<!-- Mobile-friendly stacked layout -->
<div class="w-full md:w-1/2 flex flex-col items-center mb-8 md:mb-0">
<!-- Mandala (Water Theme) -->
<svg class="w-48 md:w-96 h-48 md:h-96 text-white opacity-30" viewBox="0 0 400 400">
<g transform="translate(200,200)">
<!-- Base Circles -->
<circle r="180" fill="none" stroke="currentColor" stroke-width="1"/>
<circle r="150" fill="none" stroke="currentColor" stroke-width="1"/>
<!-- Repeat 9 segments at 40-degree intervals -->
<g transform="rotate(0)">
<path d="M0,-180 L30,-150 L-30,-150 Z"
fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90"
fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(40)">
<path d="M0,-180 L30,-150 L-30,-150 Z"
fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90"
fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(80)">
<path d="M0,-180 L30,-150 L-30,-150 Z"
fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90"
fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(120)">
<path d="M0,-180 L30,-150 L-30,-150 Z"
fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90"
fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(160)">
<path d="M0,-180 L30,-150 L-30,-150 Z"
fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90"
fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(200)">
<path d="M0,-180 L30,-150 L-30,-150 Z"
fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90"
fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(240)">
<path d="M0,-180 L30,-150 L-30,-150 Z"
fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90"
fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(280)">
<path d="M0,-180 L30,-150 L-30,-150 Z"
fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90"
fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(320)">
<path d="M0,-180 L30,-150 L-30,-150 Z"
fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90"
fill="none" stroke="currentColor" stroke-width="1"/>
</g>
</g>
</svg>
</div>
<div class="w-full md:w-1/2 flex flex-col items-center md:items-start space-y-6">
<!-- Character -->
<svg class="w-32 h-32 text-white" viewBox="0 0 200 200">
<circle cx="100" cy="100" r="70" fill="none" stroke="currentColor" stroke-width="3"/>
<path d="M70,110 Q100,140 130,110"
fill="none" stroke="currentColor" stroke-width="3"/>
<path d="M70,85 Q75,80 80,85" stroke="currentColor" stroke-width="3" fill="none"/>
<path d="M120,85 Q125,80 130,85" stroke="currentColor" stroke-width="3" fill="none"/>
<!-- Sparkle -->
<g>
<circle cx="140" cy="75" r="3" fill="currentColor">
<animate attributeName="opacity" values="1;0;1" dur="1.5s" repeatCount="indefinite"/>
</circle>
</g>
</svg>
<!-- Info Panels -->
<div class="flex flex-col space-y-4 text-white w-full max-w-md">
<div class="bg-white bg-opacity-10 p-4 rounded-lg">
<h3 class="font-bold mb-2">Clean Water Solutions</h3>
<p class="text-sm">Learn sustainable water management</p>
</div>
<div class="bg-white bg-opacity-10 p-4 rounded-lg">
<h3 class="font-bold mb-2">Get NFT Certified</h3>
<p class="text-sm">Earn while mastering water systems</p>
</div>
<button class="bg-white text-blue-600 px-6 py-3 rounded-lg font-bold hover:bg-opacity-90 w-full">
Start Learning
</button>
</div>
</div>
</div>
<!-- Slide 2: Sanitation -->
<div class="absolute inset-0 transition-opacity duration-700 opacity-0 flex flex-col md:flex-row items-center justify-center p-4 md:p-8 bg-gradient-to-br from-green-600 to-emerald-500">
<div class="w-full md:w-1/2 flex flex-col items-center mb-8 md:mb-0">
<!-- Sanitation-themed Mandala -->
<svg class="w-48 md:w-96 h-48 md:h-96 text-white opacity-30" viewBox="0 0 400 400">
<g transform="translate(200,200)">
<circle r="180" fill="none" stroke="currentColor" stroke-width="1"/>
<circle r="150" fill="none" stroke="currentColor" stroke-width="1"/>
<!-- 9 repeated segments -->
<g transform="rotate(0)">
<path d="M0,-180 L30,-150 L-30,-150 Z" fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90" fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(40)">
<path d="M0,-180 L30,-150 L-30,-150 Z" fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90" fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(80)">
<path d="M0,-180 L30,-150 L-30,-150 Z" fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90" fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(120)">
<path d="M0,-180 L30,-150 L-30,-150 Z" fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90" fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(160)">
<path d="M0,-180 L30,-150 L-30,-150 Z" fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90" fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(200)">
<path d="M0,-180 L30,-150 L-30,-150 Z" fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90" fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(240)">
<path d="M0,-180 L30,-150 L-30,-150 Z" fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90" fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(280)">
<path d="M0,-180 L30,-150 L-30,-150 Z" fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90" fill="none" stroke="currentColor" stroke-width="1"/>
</g>
<g transform="rotate(320)">
<path d="M0,-180 L30,-150 L-30,-150 Z" fill="none" stroke="currentColor" stroke-width="1"/>
<path d="M0,-150 Q30,-120 0,-90" fill="none" stroke="currentColor" stroke-width="1"/>
</g>
</g>
</svg>
</div>
<div class="w-full md:w-1/2 flex flex-col items-center md:items-start space-y-6">
<!-- Collaborative Character Scene -->
<svg class="w-64 h-64 text-white" viewBox="0 0 400 300">
<!-- First Character - Teacher -->
<g class="character-1">
<circle cx="150" cy="150" r="50" fill="none" stroke="currentColor" stroke-width="3"/>
<!-- Animated Teaching Expression -->
<path d="M130,150 Q150,170 170,150" fill="none" stroke="currentColor" stroke-width="3">
<animate attributeName="d"
values="M130,150 Q150,170 170,150;M130,160 Q150,180 170,160;M130,150 Q150,170 170,150"
dur="3s"
repeatCount="indefinite"/>
</path>
<!-- Enthusiastic Eyes -->
<path d="M135,135 L145,135" stroke="currentColor" stroke-width="3">
<animate attributeName="d"
values="M135,135 L145,135;M135,135 Q140,130 145,135;M135,135 L145,135"
dur="4s"
repeatCount="indefinite"/>
</path>
<path d="M155,135 L165,135" stroke="currentColor" stroke-width="3"/>
<!-- Teaching Gesture -->
<path d="M200,150 Q220,140 240,150"
fill="none" stroke="currentColor" stroke-width="2"
stroke-dasharray="4 4">
<animate attributeName="d"
values="M200,150 Q220,140 240,150;M200,150 Q220,160 240,150;M200,150 Q220,140 240,150"
dur="2s"
repeatCount="indefinite"/>
</path>
</g>
<!-- Second Character - Learner -->
<g class="character-2">
<defs>
<!-- Head Gradient -->
<linearGradient id="headGradient" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#6c3" />
<stop offset="100%" stop-color="#3c6" />
</linearGradient>
<!-- Body Pattern -->
<pattern id="bodyPattern" x="0" y="0" width="8" height="8" patternUnits="userSpaceOnUse">
<circle cx="2" cy="2" r="2" fill="currentColor"/>
</pattern>
</defs>
<!-- Head with gradient fill -->
<circle cx="250" cy="150" r="50" fill="url(#headGradient)" stroke="currentColor" stroke-width="3"/>
<!-- Mouth: oscillates to show curiosity/thinking -->
<path d="M230,150 Q250,170 270,150" fill="none" stroke="currentColor" stroke-width="3">
<animate attributeName="d"
values="M230,150 Q250,170 270,150;
M230,160 Q250,180 270,160;
M230,150 Q250,170 270,150"
dur="3s"
repeatCount="indefinite"
begin="0.5s"/>
</path>
<!-- Eyes: subtle blinking effect -->
<circle cx="235" cy="135" r="5" fill="currentColor">
<animate attributeName="r"
values="5;5;5;1;5"
keyTimes="0;0.8;0.85;0.9;1"
dur="3s"
repeatCount="indefinite"/>
</circle>
<circle cx="265" cy="135" r="5" fill="currentColor">
<animate attributeName="r"
values="5;5;5;1;5"
keyTimes="0;0.8;0.85;0.9;1"
dur="3s"
repeatCount="indefinite"
begin="0.3s"/>
</circle>
<!-- Torso -->
<rect x="220" y="200" width="60" height="80" fill="url(#bodyPattern)" stroke="currentColor" stroke-width="2" rx="10" ry="10" />
<!-- Small floating icon -->
<circle cx="215" cy="110" r="5" fill="#3c6" opacity="0.8">
<animateTransform attributeName="transform" type="translate" values="0,0; 0,-5; 0,0" dur="2s" repeatCount="indefinite"/>
</circle>
</g>
<!-- Shared Learning Symbols -->
<g class="learning-symbols">
<!-- Knowledge Flow -->
<path d="M175,120 Q200,100 225,120"
fill="none" stroke="currentColor" stroke-width="2"
stroke-dasharray="4 4">
<animate attributeName="d"
values="M175,120 Q200,100 225,120;M175,120 Q200,140 225,120;M175,120 Q200,100 225,120"
dur="4s"
repeatCount="indefinite"/>
</path>
<!-- Idea Sparks -->
<circle cx="200" cy="100" r="3" fill="currentColor">
<animate attributeName="opacity"
values="0;1;0"
dur="2s"
repeatCount="indefinite"/>
</circle>
<circle cx="220" cy="90" r="2" fill="currentColor">
<animate attributeName="opacity"
values="0;1;0"
dur="2s"
repeatCount="indefinite"
begin="0.5s"/>
</circle>
</g>
</svg>
<!-- Dynamic Text Panels (with background image as an example) -->
<div class="flex flex-col md:flex-row space-y-4 md:space-y-0 md:space-x-4 text-white max-w-4xl"
style="background-image: url('images/9_sm.jpg'); background-size:cover; background-position:center;">
<div class="bg-white bg-opacity-10 p-4 rounded-lg transform hover:scale-105 transition-transform duration-300">
<h3 class="font-bold mb-2">Learn Together</h3>
<p class="text-sm">Join a community of knowledge sharing</p>
</div>
<div class="bg-white bg-opacity-10 p-4 rounded-lg transform hover:scale-105 transition-transform duration-300 md:mt-8">
<h3 class="font-bold mb-2">Teach Others</h3>
<p class="text-sm">Share your expertise and grow</p>
</div>
<div class="bg-white bg-opacity-10 p-4 rounded-lg transform hover:scale-105 transition-transform duration-300 md:mt-16">
<h3 class="font-bold mb-2">Build Community</h3>
<p class="text-sm">Create lasting local impact</p>
</div>
</div>
<!-- Sanitation Info Panels -->
<div class="flex flex-col space-y-4 text-white w-full max-w-md">
<div class="bg-white bg-opacity-10 p-4 rounded-lg">
<h3 class="font-bold mb-2">Sanitation Excellence</h3>
<p class="text-sm">Master sustainable waste management systems</p>
</div>
<div class="bg-white bg-opacity-10 p-4 rounded-lg">
<h3 class="font-bold mb-2">Earn Certification</h3>
<p class="text-sm">Become a certified sanitation specialist</p>
</div>
<button class="bg-white text-green-600 px-6 py-3 rounded-lg font-bold hover:bg-opacity-90 w-full">
Join Sanitation Program
</button>
</div>
</div>
</div>
<!-- Slide 3: Renewable Energy -->
<div class="absolute inset-0 transition-opacity duration-700 opacity-0 flex flex-col md:flex-row items-center justify-center p-4 md:p-8 bg-gradient-to-br from-yellow-500 to-orange-500">
<div class="w-full md:w-1/2 flex flex-col items-center mb-8 md:mb-0">
<!-- Energy-themed Mandala (placeholder) -->
<svg class="w-48 md:w-96 h-48 md:h-96 text-white opacity-30" viewBox="0 0 400 400">
<!-- Insert your own energy motif mandala, or leave as placeholder -->
<circle cx="200" cy="200" r="180" fill="none" stroke="currentColor" stroke-width="1" />
<circle cx="200" cy="200" r="150" fill="none" stroke="currentColor" stroke-width="1" />
</svg>
</div>
<div class="w-full md:w-1/2 flex flex-col items-center md:items-start space-y-6 relative">
<!-- Theme Icons -->
<div class="absolute top-4 right-4 flex space-x-2">
<!-- Water Icon -->
<svg class="w-8 h-8 text-white opacity-70" viewBox="0 0 40 40">
<path d="M20,5 Q30,20 30,30 A10,10 0 1,1 10,30 Q10,20 20,5"
fill="none" stroke="currentColor" stroke-width="2">
<animate attributeName="stroke-dasharray"
values="0,100;100,100"
dur="2s"
fill="freeze"/>
</path>
</svg>
<!-- Energy Icon -->
<svg class="w-8 h-8 text-white opacity-70" viewBox="0 0 40 40">
<path d="M20,5 L25,20 L35,20 L15,35 L20,20 L10,20 Z"
fill="none" stroke="currentColor" stroke-width="2">
<animate attributeName="stroke-dasharray"
values="0,100;100,100"
dur="2s"
fill="freeze"/>
</path>
</svg>
<!-- Food Icon -->
<svg class="w-8 h-8 text-white opacity-70" viewBox="0 0 40 40">
<path d="M20,10 Q30,20 20,30 Q10,20 20,10"
fill="none" stroke="currentColor" stroke-width="2">
<animate attributeName="stroke-dasharray"
values="0,100;100,100"
dur="2s"
fill="freeze"/>
</path>
</svg>
</div>
<!-- Energy Info Panels -->
<div class="flex flex-col space-y-4 text-white w-full max-w-md">
<div class="bg-white bg-opacity-10 p-4 rounded-lg">
<h3 class="font-bold mb-2">Renewable Energy Mastery</h3>
<p class="text-sm">Learn to implement solar and sustainable power</p>
</div>
<div class="bg-white bg-opacity-10 p-4 rounded-lg">
<h3 class="font-bold mb-2">Energy Innovation</h3>
<p class="text-sm">Design and maintain renewable systems</p>
</div>
<button class="bg-white text-yellow-600 px-6 py-3 rounded-lg font-bold hover:bg-opacity-90 w-full">
Start Energy Training
</button>
</div>
</div>
</div>
<!-- Slide 4: Local Food Systems -->
<div class="absolute inset-0 transition-opacity duration-700 opacity-0 flex flex-col md:flex-row items-center justify-center p-4 md:p-8 bg-gradient-to-br from-green-500 to-lime-500">
<div class="w-full md:w-1/2 flex flex-col items-center mb-8 md:mb-0">
<!-- Food-themed Mandala (placeholder) -->
<svg class="w-48 md:w-96 h-48 md:h-96 text-white opacity-30" viewBox="0 0 400 400">
<!-- Insert your own plant-themed mandala here -->
<circle cx="200" cy="200" r="180" fill="none" stroke="currentColor" stroke-width="1" />
<circle cx="200" cy="200" r="150" fill="none" stroke="currentColor" stroke-width="1" />
</svg>
</div>
<div class="w-full md:w-1/2 flex flex-col items-center md:items-start space-y-6">
<!-- Character (optional placeholder) -->
<svg class="w-32 h-32 text-white" viewBox="0 0 200 200">
<circle cx="100" cy="100" r="70" fill="none" stroke="currentColor" stroke-width="3"/>
<path d="M70,110 Q100,140 130,110"
fill="none" stroke="currentColor" stroke-width="3"/>
</svg>
<!-- Food Systems Info Panels -->
<div class="flex flex-col space-y-4 text-white w-full max-w-md">
<div class="bg-white bg-opacity-10 p-4 rounded-lg">
<h3 class="font-bold mb-2">Sustainable Agriculture</h3>
<p class="text-sm">Create thriving local food systems</p>
</div>
<div class="bg-white bg-opacity-10 p-4 rounded-lg">
<h3 class="font-bold mb-2">Food Security</h3>
<p class="text-sm">Build community gardens and food networks</p>
</div>
<button class="bg-white text-green-600 px-6 py-3 rounded-lg font-bold hover:bg-opacity-90 w-full">
Learn Food Systems
</button>
</div>
</div>
</div>
<!-- Slide 5: Community Health -->
<div class="absolute inset-0 transition-opacity duration-700 opacity-0 flex flex-col md:flex-row items-center justify-center p-4 md:p-8 bg-gradient-to-br from-red-500 to-pink-500">
<div class="w-full md:w-1/2 flex flex-col items-center mb-8 md:mb-0">
<!-- Health-themed Mandala (placeholder) -->
<svg class="w-48 md:w-96 h-48 md:h-96 text-white opacity-30" viewBox="0 0 400 400">
<!-- Insert your own health-themed mandala here -->
<circle cx="200" cy="200" r="180" fill="none" stroke="currentColor" stroke-width="1" />
<circle cx="200" cy="200" r="150" fill="none" stroke="currentColor" stroke-width="1" />
</svg>
</div>
<div class="w-full md:w-1/2 flex flex-col items-center md:items-start space-y-6">
<!-- Character (optional placeholder) -->
<svg class="w-32 h-32 text-white" viewBox="0 0 200 200">
<circle cx="100" cy="100" r="70" fill="none" stroke="currentColor" stroke-width="3"/>
<path d="M70,110 Q100,140 130,110"
fill="none" stroke="currentColor" stroke-width="3"/>
</svg>
<!-- Health Info Panels -->
<div class="flex flex-col space-y-4 text-white w-full max-w-md">
<div class="bg-white bg-opacity-10 p-4 rounded-lg">
<h3 class="font-bold mb-2">Community Health</h3>
<p class="text-sm">Establish local health support systems</p>
</div>
<div class="bg-white bg-opacity-10 p-4 rounded-lg">
<h3 class="font-bold mb-2">Clinical Skills</h3>
<p class="text-sm">Learn essential community healthcare</p>
</div>
<button class="bg-white text-red-500 px-6 py-3 rounded-lg font-bold hover:bg-opacity-90 w-full">
Begin Health Training
</button>
</div>
</div>
</div>
</div> <!-- end .carousel-container -->
<!-- Navigation Dots -->
<div class="absolute bottom-4 left-1/2 transform -translate-x-1/2 flex space-x-2">
<button class="w-3 h-3 rounded-full bg-white bg-opacity-50 focus:outline-none" onclick="goToSlide(0)"></button>
<button class="w-3 h-3 rounded-full bg-white bg-opacity-50 focus:outline-none" onclick="goToSlide(1)"></button>
<button class="w-3 h-3 rounded-full bg-white bg-opacity-50 focus:outline-none" onclick="goToSlide(2)"></button>
<button class="w-3 h-3 rounded-full bg-white bg-opacity-50 focus:outline-none" onclick="goToSlide(3)"></button>
<button class="w-3 h-3 rounded-full bg-white bg-opacity-50 focus:outline-none" onclick="goToSlide(4)"></button>
</div>
<!-- Custom Modal -->
<div id="slideModal" class="fixed inset-0 bg-black bg-opacity-50 hidden z-50 flex items-center justify-center">
<div class="bg-white rounded-lg p-8 max-w-lg w-full mx-4 transform transition-all">
<div class="flex justify-between items-center mb-4">
<h3 id="modalTitle" class="text-xl font-bold"></h3>
<button onclick="closeModal()" class="text-gray-500 hover:text-gray-700">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</div>
<div id="modalContent" class="prose"></div>
<div class="mt-6 flex justify-end">
<button onclick="closeModal()" class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700">Close</button>
</div>
</div>
</div>
</div> <!-- end of relative container -->
<!-- Scripts -->
<script>
let currentSlide = 0;
const slides = document.querySelectorAll('.carousel-container > div');
// ^ This grabs the 5 slides inside .carousel-container
const dots = document.querySelectorAll('.absolute.bottom-4 button');
const totalSlides = slides.length;
let autoplayInterval;
let touchStartX = 0;
let touchEndX = 0;
const container = document.querySelector('.carousel-container');
// Fill out modal content for all 5 slides:
const slideContent = [
{
title: "Clean Water Solutions",
content: `
<h4>Learn Water Management</h4>
<p>Discover sustainable approaches to water purification and management:</p>
<ul>
<li>DIY filtration systems</li>
<li>Rainwater harvesting</li>
<li>Water conservation techniques</li>
</ul>
`
},
{
title: "Sanitation Excellence",
content: `
<h4>Master Sanitation Systems</h4>
<p>Learn about sustainable waste management:</p>
<ul>
<li>Composting toilets</li>
<li>Greywater systems</li>
<li>Waste reduction strategies</li>
</ul>
`
},
{
title: "Renewable Energy",
content: `
<h4>Empower Your Community</h4>
<p>Explore green energy solutions:</p>
<ul>
<li>Solar panel installation</li>
<li>Wind turbines</li>
<li>Off-grid living tips</li>
</ul>
`
},
{
title: "Local Food Systems",
content: `
<h4>Farm-to-Table Approaches</h4>
<p>Grow your own healthy produce:</p>
<ul>
<li>Community gardening</li>
<li>Permaculture</li>
<li>Seed saving techniques</li>
</ul>
`
},
{
title: "Community Health",
content: `
<h4>Essential Health Practices</h4>
<p>Strengthen local well-being:</p>
<ul>
<li>Preventive care</li>
<li>Basic first-aid</li>
<li>Mental health support</li>
</ul>
`
},
];
function updateSlides() {
slides.forEach((slide, index) => {
slide.style.opacity = (index === currentSlide) ? '1' : '0';
});
dots.forEach((dot, index) => {
dot.classList.toggle('bg-opacity-100', index === currentSlide);
dot.classList.toggle('bg-opacity-50', index !== currentSlide);
});
}
function goToSlide(slideIndex) {
currentSlide = slideIndex;
updateSlides();
resetAutoplay();
}
function handleSwipe() {
const swipeDistance = touchEndX - touchStartX;
const minSwipeDistance = 50;
if (Math.abs(swipeDistance) > minSwipeDistance) {
if (swipeDistance > 0) {
currentSlide = (currentSlide - 1 + totalSlides) % totalSlides;
} else {
currentSlide = (currentSlide + 1) % totalSlides;
}
updateSlides();
resetAutoplay();
}
}
// Touch events
container.addEventListener('touchstart', e => {
touchStartX = e.changedTouches[0].screenX;
});
container.addEventListener('touchend', e => {
touchEndX = e.changedTouches[0].screenX;
handleSwipe();
});
// Modal functions
function openModal() {
const modal = document.getElementById('slideModal');
const modalTitle = document.getElementById('modalTitle');
const modalContentEl = document.getElementById('modalContent');
// Safely handle if currentSlide is out of range
if (slideContent[currentSlide]) {
modalTitle.textContent = slideContent[currentSlide].title;
modalContentEl.innerHTML = slideContent[currentSlide].content;
} else {
modalTitle.textContent = "No Slide Data";
modalContentEl.innerHTML = "<p>No content available.</p>";
}
modal.classList.remove('hidden');
pauseAutoplay();
}
function closeModal() {
const modal = document.getElementById('slideModal');
modal.classList.add('hidden');
resumeAutoplay();
}
// Attach modal opening to the *first clickable button* on each slide
// (Feel free to adjust if you have multiple buttons.)
slides.forEach((slide, index) => {
const button = slide.querySelector('button');
if (button) {
button.addEventListener('click', (e) => {
e.preventDefault();
openModal();
});
}
});
// Autoplay
function startAutoplay() {
autoplayInterval = setInterval(() => {
currentSlide = (currentSlide + 1) % totalSlides;
updateSlides();
}, 5000);
}
function resetAutoplay() {
clearInterval(autoplayInterval);
startAutoplay();
}
function pauseAutoplay() {
clearInterval(autoplayInterval);
}
function resumeAutoplay() {
startAutoplay();
}
// Keyboard navigation
document.addEventListener('keydown', (e) => {
if (e.key === 'ArrowRight') {
currentSlide = (currentSlide + 1) % totalSlides;
updateSlides();
resetAutoplay();
} else if (e.key === 'ArrowLeft') {
currentSlide = (currentSlide - 1 + totalSlides) % totalSlides;
updateSlides();
resetAutoplay();
}
});
// Initialize
updateSlides();
startAutoplay();
</script>
</body>
</html>