forked from Mar1a0l1ve1ra/CPX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeatured-projects.html
751 lines (694 loc) · 27 KB
/
featured-projects.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./output.css" />
<link rel="stylesheet" href="./index.css" />
<title>CPX Featured projects</title>
</head>
<body id="body" class="bg-ivoryMist font-inter">
<div
class="pointer-events-none w-10 h-10 fake-activity fixed bg-transparent"
></div>
<button
id="scrollToTop"
class="hidden fixed bottom-6 right-6 size-12 bg-sunsetRed rounded-full shadow-xl z-[70] animate-bounce p-2"
>
<img
src="./assets/svg/backToTopArrow.svg"
alt="back to top"
class="w-full h-full object-cover"
/>
</button>
<!-- Back to top btn end -->
<nav id="nav-hero-wrapper" class="">
<div
class="orange-moving-object ease-linear absolute z-[1004] opacity-0 pointer-events-none"
>
<img src="./assets/img/orangeLogoIcon.png" class="w-full" alt="" />
</div>
<div
class="white-moving-object ease-linear z-[1005] fixed opacity-0 pointer-events-none"
>
<img src="./assets/img/whiteLogoIcon.png" class="w-full" alt="" />
</div>
<!-- Navbar and sidebar start -->
<div
id="hero"
class="2xl:max-w-[1764px] xl:max-w-[1322px] max-w-[951px] relative navbar-wrapper w-full mx-auto px-4"
>
<!-- Navbar -->
<div class="flex justify-between items-center gap-5 pt-4 md:pt-4">
<!-- Logo -->
<div class="flex logo-wrappper">
<div class="final-pos">
<a href="/">
<img
class="h-[70px] md:h-[90px]"
src="./assets/img/orangeLogoIcon.png"
alt="logo"
/>
</a>
</div>
<a href="/">
<img
class="h-[70px] logo-text md:h-[90px]"
src="./assets/img/logotext.png"
alt="logo-text"
/>
</a>
</div>
<div class="flex items-center gap-5 xl:gap-8 max-lg:hidden">
<a href="/homepage.html" class="nav-link navbar-navlink"> Home </a>
<a href="/homepage.html" class="nav-link navbar-navlink">
About us
</a>
<a href="/homepage.html" class="nav-link navbar-navlink">
Services
</a>
<a href="/homepage.html" class="nav-link navbar-navlink">
Projects
</a>
</div>
<div class="flex items-center gap-5 xl:gap-10 max-lg:hidden">
<a href="contact-us.html">
<button
class="bg-sunsetRed px-5 xl:px-7 py-4 xl:min-w-[162px] text-white text-base font-medium leading-[133%] hover:bg-transparent border-[1px] border-sunsetRed hover:text-sunsetRed transition-all duration-300 ease-in-out"
type="submit"
>
Contact Us
</button>
</a>
<div class="relative">
<button
id="languageDropdownButton"
class="flex items-center gap-1 w-[140px]"
>
<img src="./assets/svg/languageicon.svg" alt="Language Icon" />
<p
id="languageText"
class="lg:text-graphiteGray text-white text-base font-medium leading-normal"
>
English
</p>
<img src="/assets/svg/arrow.svg" alt="arrow" />
</button>
<div
id="languageDropdown"
class="hidden overflow-hidden absolute right-0 mt-2 w-32 bg-white rounded-lg shadow-lg"
>
<a
href="/featured-projects.html"
class="language-text"
data-value="English"
>English</a
>
<a
href="/projectos-em-destaque.html"
class="language-text"
data-value="Português"
>Português</a
>
</div>
</div>
</div>
<img
id="navbtn"
class="lg:hidden cursor-pointer hover:scale-110 ease-in-out duration-300 transition-all"
src="/assets/svg/HamburgerIcon.svg"
alt="HamburgerIcon"
/>
</div>
</div>
</nav>
<!-- Navbar and sidebar end -->
<!------------ sidebar start -------->
<div class="2xl:flex 2xl:items-center 2xl:justify-center">
<div class="2xl:flex-shrink-0">
<div
id="sidebarbtn"
class="fixed z-[10000] bg-sunsetRed top-0 w-full sm:w-[50%] left-[-105%] h-screen p-6 duration-300 ease-in-out lg:hidden shadow-2xl"
>
<div class="flex flex-col gap-6">
<img
class="absolute right-3 hover:rotate-90 duration-300 ease-in-out transition-all cursor-pointer"
id="cancel"
src="/assets/svg/Cross-Icon.svg"
alt="Cross-Icon"
/>
<a href="/homepage.html" class="sidebar-navlink"> Home </a>
<a href="/homepage.html" class="nav-link sidebar-navlink">
About Us
</a>
<a href="/homepage.html" class="nav-link sidebar-navlink">
Services
</a>
<a href="/homepage.html" class="nav-link sidebar-navlink">
Projects
</a>
<div class="flex gap-10 flex-col lg:hidden">
<a href="/contact-us.html">
<button
class="bg-white md:px-7 py-2 md:py-4 text-sunsetRed hover:text-white text-base font-medium leading-[133%] hover:bg-transparent border-[1px] border-white transition-all duration-300 ease-in-out max-w-[200px] w-full"
type="submit"
>
Contact Us
</button>
</a>
<div class="relative">
<button
id="sidebarLanguageDropdownButton"
class="flex items-center gap-3"
>
<img src="/assets/svg/language.svg" alt="language" />
<p
id="sidebarLanguageText"
class="text-white text-xl font-medium leading-normal"
>
English
</p>
<img
src="/assets/svg/sidebar-downward-icon.svg"
alt="sidebar-downward-icon"
/>
</button>
<div
id="sidebarLanguageDropdown"
class="hidden overflow-hidden absolute mt-2 w-32 bg-white rounded-lg shadow-lg"
>
<a
href="/featured-projects.html"
class="language-text"
data-value="English"
>English</a
>
<a
href="/projectos-em-destaque.html"
class="language-text"
data-value="Português"
>Português</a
>
</div>
</div>
</div>
</div>
</div>
<div
id="sidebar-overlay"
class="fixed bg-black/30 backdrop-blur-sm inset-0 z-[60] hidden"
></div>
</div>
</div>
<!-- FILTER SECTION -->
<section
class="2xl:max-w-[1764px] xl:max-w-[1322px] max-w-[951px] w-full mx-auto px-4 md:px-8 2xl:px-12 flex flex-col items-center 2xl:mb-[89px] xl:mb-[70px] lg:mb-[60px] md:mb-[50px] mb-10"
>
<div class="lg:mt-[76px] mt-10 w-full">
<h3 class="heading font-bold">Featured Projects</h3>
<p
class="sm:mt-[21px] mt-[14px] text-xl text-deepCharcoal 2xl:mb-[76px] xl:mb-[56px] sm:mb-[60px] mb-[41px]"
>
The portfolio below showcases the wide range of projects we deliver.
For bespoke projects, don’t hesitate to get in touch with us.
</p>
<!-- FILTER-BUTTONS -->
<div
class="flex flex-wrap gap-2 sm:gap-3 2xl:justify-between 2xl:mb-[55px] mb-8 w-full font-inter whitespace-nowrap"
id="filter-buttons"
>
<button class="filter-btn filter-buttons active" data-category="all">
All
</button>
<button
class="filter-btn filter-buttons border-black"
data-category="heritage"
>
Hospitals and Medical Buildings
</button>
<button
class="filter-btn filter-buttons border-black"
data-category="museums"
>
Museums
</button>
<button
class="filter-btn filter-buttons border-black"
data-category="service"
>
Service Buildings
</button>
<button
class="filter-btn filter-buttons border-black"
data-category="education"
>
Education facilities
</button>
<button
class="filter-btn filter-buttons border-black"
data-category="residential"
>
Residential Buildings
</button>
<button
class="filter-btn filter-buttons border-black"
data-category="commercial"
>
Industrial Buildings
</button>
<button
class="filter-btn filter-buttons border-black"
data-category="others"
>
Others
</button>
</div>
<!-- Image Gallery Grid -->
<div class="flex flex-col items-center justify-center">
<div
id="gallery"
class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-x-7 3xl:gap-x-9 gap-y-[23px] sm:gap-y-[45px] 3xl:gap-y-[50px]"
>
<!-- Images will be dynamically inserted here -->
</div>
<!-- Loading Spinner -->
<div
id="loading-spinner"
class="flex items-center justify-center mt-10 z-50"
>
<div class="loader"></div>
</div>
<a
class="2xl:max-w-[425px] max-w-[400px] w-full mx-auto flex justify-center items-center"
href="/contact-us.html"
>
<button
class="primary-button !w-full 2xl:mt-[114px] xl:mt-[82px] mt-8 sm:mt-14"
>
Let’s Chat
</button>
</a>
</div>
<!------------ modal--------------- -->
<!-- Modal Structure -->
<div id="imageModal" class="modal-overlay">
<div class="modal-content px-4 !z-[2000]">
<div class="modal-main bg-white rounded-lg">
<div class="modal-header px-4">
<h2>Project Details</h2>
<button id="closeModal" class="modal-close-btn">×</button>
</div>
<div class="modal-body p-3 sm:p-6">
<div class="relative">
<!-- Swiper Container -->
<swiper-container
class="mySwiper !h-[250px] sm:!h-[340px]"
loop="false"
space-between="30"
centered-slides="true"
autoplay-delay="2500"
autoplay-disable-on-interaction="false"
navigation="false"
slides-per-view="1"
>
</swiper-container>
<!-- Custom Navigation Buttons - Now always visible -->
<button
class="swiper-btn-prev absolute left-4 top-1/2 -translate-y-1/2 z-10 !h-[30px] !w-[30px] sm:!h-[40px] sm:!w-[40px] bg-white p-1 rounded-full flex justify-center items-center shadow-md hover:bg-gray-100 transition-colors"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="100%"
height="100%"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m15 18-6-6 6-6" />
</svg>
</button>
<button
class="swiper-btn-next absolute right-0 top-1/2 -translate-y-1/2 z-10 bg-white rounded-full shadow-md p-1 !h-[30px] !w-[30px] sm:!h-[40px] sm:!w-[40px] flex justify-center items-center hover:bg-gray-100 transition-colors"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="100%"
height="100%"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m9 18 6-6-6-6" />
</svg>
</button>
<!-- Custom Pagination -->
<div class="flex items-center justify-center">
<div
class="swiper-pagination-custom md:rounded-[20px] rounded absolute bottom-4 left-1/2 -translate-x-1/2 z-10 flex gap-2 border !border-white !border-opacity-75"
></div>
</div>
</div>
<div class="modal-text">
<h3
id="modalTitle"
class="text-xl font-semibold mb-1 mt-2 lg:text-[24px]"
></h3>
<div
id="modalArchitect"
class="modal-architect text-base sm:text-lg text-[#6b7280] mb-2"
></div>
<div
id="modalLocation"
class="modal-location text-base sm:text-lg text-[#6b7280]"
></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- FOOTER -->
<footer>
<span class="!bg-deepCharcoal opacity-[0.32] w-full flex h-[1px]"></span>
<div
class="2xl:max-w-[1764px] xl:max-w-[1322px] max-w-[880px] w-full mx-auto px-4 md:pt-14 pt-10 !pb-[22px] sm:!pb-[100px] flex xl:flex-row flex-col gap-4 items-center justify-between"
>
<div
class="text-graphiteGray text-sm md:text-[15px] font-medium xl:w-fit w-full text-center"
>
© Copyright 2024 CPX, Lda. - Consulting and Engineering Projects -
<a
href="mailto:[email protected]"
class="underline text-graphiteGray text-sm md:text-[15px]"
>
</div>
<div
class="flex flex-wrap items-center justify-between xm:gap-10 gap-4 2xl:gap-[75px] xl:w-fit w-full text-center"
>
<div
class="flex items-center text-graphiteGray text-sm md:text-[15px] font-medium gap-1 mx-auto"
>
<p>website:</p>
<a
href="https://www.mariaoliveira.co.uk/"
target="_blank"
class="underline text-graphiteGray text-sm md:text-[15px] font-medium"
>www.mariaoliveira.co.uk</a
>
</div>
<a
class="textgraphiteGray text-graphiteGray text-sm md:text-[15px] font-medium underline mx-auto"
href="/privacy-policy.html"
>Terms & Policies</a
>
</div>
</div>
</footer>
<!-- ARRAY-ITEM -->
<script src="/helper/featured-projects.js"></script>
<script>
// State variables
let currentPage = 0;
const itemsPerPage = 8;
let isLoading = false;
let currentCategory = "all";
let filteredImages = allImages;
// DOM Elements
const gallery = document.getElementById("gallery");
const filterButtons = document.querySelectorAll(".filter-btn");
const loadingSpinner = document.getElementById("loading-spinner");
// Add new element for end message
const endMessage = document.createElement("div");
endMessage.className = "text-center text-xl text-gray-600 mt-8 mb-4";
endMessage.style.display = "none";
gallery.parentNode.insertBefore(endMessage, loadingSpinner);
function openModal(src, alt) {
const modal = document.getElementById("imageModal");
const swiperContainer = modal.querySelector("swiper-container");
const modalTitle = document.getElementById("modalTitle");
const modalArchitect = document.getElementById("modalArchitect");
const modalLocation = document.getElementById("modalLocation");
const imageData = allImages.find((img) => img.alt === alt);
if (imageData) {
// Clear existing slides
swiperContainer.innerHTML = "";
// Add slides for each image
imageData.images.forEach((imgSrc) => {
swiperContainer.innerHTML += `
<swiper-slide>
<img src="${imgSrc}" alt="${imageData.alt}" class="w-full h-full rounded-lg object-cover">
</swiper-slide>
`;
});
modalTitle.textContent = imageData.title;
modalArchitect.textContent = `${imageData.architect}, ${imageData.year}`;
modalLocation.textContent = imageData.location;
}
modal.classList.add("active");
document.body.style.overflow = "hidden";
}
function closeModal() {
const modal = document.getElementById("imageModal");
modal.classList.remove("active");
document.body.style.overflow = "";
}
// Event listeners for modal
document.addEventListener("DOMContentLoaded", () => {
const modal = document.getElementById("imageModal");
const closeBtn = document.getElementById("closeModal");
closeBtn.addEventListener("click", closeModal);
modal.addEventListener("click", (e) => {
if (e.target === modal) {
closeModal();
}
});
document.addEventListener("keydown", (e) => {
if (e.key === "Escape" && modal.classList.contains("active")) {
closeModal();
}
});
});
// Create image element
function createImageElement(image) {
const thumbnailSrc = image.images ? image.images[0] : image.src;
return `
<div class="relative group cursor-pointer" onclick="openModal('${thumbnailSrc}', '${image.alt}')">
<img class="transition-transform hover:scale-105 cursor-pointer w-full min-h-[233px] max-h-[233px] object-center"
src="${thumbnailSrc}" alt="${image.alt}" loading="lazy">
</div>
`;
}
// Load more images
function loadMoreImages() {
if (isLoading) return;
const start = currentPage * itemsPerPage;
const end = start + itemsPerPage;
const nextImages = filteredImages.slice(start, end);
if (nextImages.length === 0) {
loadingSpinner.classList.add("hidden");
endMessage.style.display = "block";
return;
}
isLoading = true;
loadingSpinner.classList.remove("hidden");
endMessage.style.display = "none";
setTimeout(() => {
nextImages.forEach((image) => {
gallery.innerHTML += createImageElement(image);
});
currentPage++;
isLoading = false;
loadingSpinner.classList.add("hidden");
if (currentPage * itemsPerPage >= filteredImages.length) {
endMessage.style.display = "block";
}
}, 800);
}
// Filter images
function filterImages(category) {
currentPage = 0;
currentCategory = category;
endMessage.style.display = "none";
filteredImages =
category === "all"
? allImages
: allImages.filter((img) => img.category === category);
gallery.innerHTML = "";
loadMoreImages();
}
// Event Listeners for filter buttons
filterButtons.forEach((button) => {
button.addEventListener("click", () => {
filterButtons.forEach((btn) => btn.classList.remove("active"));
button.classList.add("active");
const category = button.dataset.category;
filterImages(category);
});
});
// Infinite scroll handler
function handleScroll() {
if (isLoading) return;
const endOfPage =
window.innerHeight + window.scrollY >=
document.documentElement.scrollHeight - 100;
if (endOfPage && currentPage * itemsPerPage < filteredImages.length) {
loadMoreImages();
}
} // Modal event
document.addEventListener("DOMContentLoaded", () => {
const modal = document.getElementById("imageModal");
const closeBtn = document.getElementById("closeModal");
closeBtn.addEventListener("click", closeModal);
modal.addEventListener("click", (e) => {
if (e.target === modal) {
closeModal();
}
});
document.addEventListener("keydown", (e) => {
if (e.key === "Escape" && !modal.classList.contains("hidden")) {
closeModal();
}
});
});
// Add scroll event listener
window.addEventListener("scroll", handleScroll);
// Initial load
filterImages("all");
</script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"
integrity="sha512-7eHRwcbYkK4d9g/6tD/mhkf++eoTHwpNM9woBxtPUBWm67zeAfFC+HrdoE2GanKeocly/VxeLvIqwvCdk7qScg=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/ScrollTrigger.min.js"
integrity="sha512-onMTRKJBKz8M1TnqqDuGBlowlH0ohFzMXYRNebz+yOcc5TQr/zAKsthzhuv0hiyUKEiQEQXEynnXCvNTOk50dg=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"
integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<!-- Include GSAP and ScrollTrigger -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.4/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.4/ScrollTrigger.min.js"></script>
<!-- JS file -->
<script src="./index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-element-bundle.min.js"></script>
<script>
function openModal(src, alt) {
const modal = document.getElementById("imageModal");
const swiperContainer = modal.querySelector("swiper-container");
const modalTitle = document.getElementById("modalTitle");
const modalArchitect = document.getElementById("modalArchitect");
const modalLocation = document.getElementById("modalLocation");
const paginationContainer = modal.querySelector(
".swiper-pagination-custom"
);
const imageData = allImages.find((img) => img.alt === alt);
if (imageData) {
// Clear existing slides
swiperContainer.innerHTML = "";
paginationContainer.innerHTML = "";
// Add slides for each image
imageData.images.forEach((imgSrc, index) => {
swiperContainer.innerHTML += `
<swiper-slide>
<img src="${imgSrc}" alt="${imageData.alt}" class="w-full h-full rounded-lg object-cover">
</swiper-slide>
`;
// Add thumbnail pagination bullets
paginationContainer.innerHTML += `
<button
class="custom-pagination-bullet ${index === 0 ? "active" : ""}"
data-index="${index}"
style="background-image: url('${imgSrc}')">
</button>
`;
});
modalTitle.textContent = imageData.title;
modalArchitect.textContent = `${imageData.architect}, ${imageData.year}`;
modalLocation.textContent = imageData.location;
// Navigation buttons
const prevBtn = modal.querySelector(".swiper-btn-prev");
const nextBtn = modal.querySelector(".swiper-btn-next");
const updateButtonState = () => {
const swiperInstance = swiperContainer.swiper;
const isBeginning = swiperInstance.isBeginning;
const isEnd = swiperInstance.isEnd;
// Update 'prev' button
prevBtn.disabled = isBeginning;
prevBtn.classList.toggle("no-pointer", isBeginning);
prevBtn.classList.toggle("bg-fade", isBeginning);
// Update 'next' button
nextBtn.disabled = isEnd;
nextBtn.classList.toggle("no-pointer", isEnd);
nextBtn.classList.toggle("bg-fade", isEnd);
};
const updatePagination = () => {
const activeIndex = swiperContainer.swiper.realIndex;
paginationContainer
.querySelectorAll(".custom-pagination-bullet")
.forEach((bullet, index) => {
bullet.classList.toggle("active", index === activeIndex);
});
};
const initializePagination = () => {
const bullets = paginationContainer.querySelectorAll(
".custom-pagination-bullet"
);
bullets.forEach((bullet) => {
const index = parseInt(bullet.dataset.index, 10);
bullet.addEventListener("click", () => {
swiperContainer.swiper.slideTo(index);
});
});
};
// Wait for Swiper to be ready
const initializeSwiper = () => {
if (swiperContainer.swiper) {
const swiperInstance = swiperContainer.swiper;
// Add navigation listeners
prevBtn.addEventListener("click", () =>
swiperInstance.slidePrev()
);
nextBtn.addEventListener("click", () =>
swiperInstance.slideNext()
);
// Update states on slide change
swiperInstance.on("slideChange", () => {
updateButtonState();
updatePagination();
});
// Initialize pagination
initializePagination();
// Initial state update
updateButtonState();
updatePagination();
} else {
// If swiper isn't ready yet, try again
setTimeout(initializeSwiper, 100);
}
};
// Start initialization
initializeSwiper();
}
modal.classList.add("active");
document.body.style.overflow = "hidden";
}
</script>
<script src="/language-handler.js"></script>
</body>
</html>