Spaces:
Running
Running
File size: 29,454 Bytes
bf6d14d | 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 | <!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Case Study - {{ case.title }} | TTL1979</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
body {
background-color: #000;
color: #fff;
overflow-x: hidden;
}
.parallax-bg {
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
overflow: hidden;
}
.glow-effect {
position: absolute;
width: 200px;
height: 200px;
border-radius: 50%;
filter: blur(60px);
opacity: 0.3;
z-index: 0;
}
.glow-teal {
background: #38b2ac;
}
.glow-blue {
background: #3b82f6;
}
.glow-purple {
background: #8b5cf6;
}
.case-comparison {
position: relative;
width: 100%;
height: 600px;
overflow: hidden;
border-radius: 16px;
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.before-image, .after-image {
position: absolute;
width: 100%;
height: 100%;
object-fit: cover;
}
.before-image {
clip-path: polygon(0 0, 50% 0, 50% 100%, 0% 100%);
}
.after-image {
clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%);
}
.comparison-slider {
position: absolute;
top: 0;
bottom: 0;
width: 4px;
background: white;
left: 50%;
transform: translateX(-50%);
cursor: ew-resize;
z-index: 10;
}
.comparison-slider::before {
content: '';
position: absolute;
width: 50px;
height: 50px;
border-radius: 50%;
background: white;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.comparison-slider::after {
content: '\f337';
font-family: 'Font Awesome 6 Free';
font-weight: 900;
position: absolute;
color: #000;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 20px;
}
.treatment-timeline {
position: relative;
padding-left: 30px;
}
.treatment-timeline::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 4px;
background: linear-gradient(to bottom, #3b82f6, #8b5cf6);
}
.timeline-item {
position: relative;
padding-bottom: 30px;
}
.timeline-item::before {
content: '';
position: absolute;
left: -33px;
top: 5px;
width: 12px;
height: 12px;
border-radius: 50%;
background: #3b82f6;
border: 2px solid white;
}
.gallery-slider {
scroll-snap-type: x mandatory;
scroll-behavior: smooth;
}
.gallery-slide {
scroll-snap-align: start;
flex: 0 0 100%;
}
@media (max-width: 768px) {
.parallax-bg {
background-attachment: scroll;
}
.case-comparison {
height: 400px;
}
.gallery-slide {
flex: 0 0 100%;
}
}
</style>
</head>
<body>
<!-- Floating Glow Effects -->
<div class="glow-effect glow-teal" style="top: 10%; left: 10%;"></div>
<div class="glow-effect glow-blue" style="top: 60%; right: 5%;"></div>
<div class="glow-effect glow-purple" style="bottom: 10%; left: 20%;"></div>
<!-- Header -->
<header class="py-6 px-4 fixed w-full z-50 bg-black bg-opacity-80 backdrop-filter backdrop-blur-sm">
<div class="container mx-auto flex justify-between items-center">
<div class="flex items-center">
<i class="fas fa-tooth text-3xl text-teal-400 mr-3"></i>
<h1 class="text-2xl font-bold bg-gradient-to-r from-teal-400 to-blue-500 bg-clip-text text-transparent">TTL1979</h1>
</div>
<button id="menu-toggle" class="md:hidden text-white">
<i class="fas fa-bars text-2xl"></i>
</button>
<nav id="main-nav" class="hidden md:flex space-x-8">
<a href="/" class="nav-link text-white hover:text-teal-400 transition">Home</a>
<a href="/thuvien" class="nav-link text-white hover:text-teal-400 transition">Thư viện</a>
<a href="/dichvu" class="nav-link text-white hover:text-teal-400 transition">Dịch vụ</a>
<a href="/lienhe" class="nav-link text-white hover:text-teal-400 transition">Liên hệ</a>
</nav>
</div>
</header>
<!-- Mobile Menu -->
<div id="mobile-menu" class="fixed inset-0 bg-black bg-opacity-90 z-40 hidden flex-col items-center justify-center space-y-8">
<button id="close-menu" class="absolute top-6 right-6 text-white text-2xl">
<i class="fas fa-times"></i>
</button>
<a href="/" class="text-white text-2xl hover:text-teal-400 transition">Home</a>
<a href="/thuvien" class="text-white text-2xl hover:text-teal-400 transition">Thư viện</a>
<a href="/dichvu" class="text-white text-2xl hover:text-teal-400 transition">Dịch vụ</a>
<a href="/lienhe" class="text-white text-2xl hover:text-teal-400 transition">Liên hệ</a>
</div>
<!-- Case Study Hero -->
<section class="pt-32 pb-20 px-4">
<div class="container mx-auto">
{% if case %}
<div class="flex flex-col md:flex-row items-center mb-12">
<div class="md:w-1/2 mb-8 md:mb-0 md:pr-8">
<span class="inline-block bg-gradient-to-r from-teal-500 to-blue-600 text-white px-4 py-1 rounded-full text-sm font-semibold mb-4">Case #{{ case.case_id }}</span>
<h1 class="text-4xl md:text-5xl font-bold mb-6 bg-gradient-to-r from-teal-400 to-blue-500 bg-clip-text text-transparent">{{ case.title }}</h1>
<p class="text-xl text-gray-300 mb-6">{{ case.initial_condition }}</p>
<div class="flex items-center">
<div class="w-16 h-16 rounded-full overflow-hidden border-2 border-teal-500 mr-4">
<img src="https://randomuser.me/api/portraits/women/44.jpg" alt="Patient" class="w-full h-full object-cover">
</div>
<div>
<h4 class="font-bold">{{ case.patient_name }}</h4>
<p class="text-teal-400">Khách hàng hài lòng</p>
</div>
</div>
</div>
<div class="md:w-1/2">
<div class="bg-gradient-to-br from-teal-500 to-blue-600 p-1 rounded-2xl">
<div class="case-comparison bg-black rounded-xl overflow-hidden">
<img src="{{ case.before_image }}" alt="Before treatment" class="before-image">
<img src="{{ case.after_image }}" alt="After treatment" class="after-image">
<div class="comparison-slider"></div>
<div class="absolute top-4 left-4 bg-black bg-opacity-70 text-white px-3 py-1 rounded-full text-sm">
<i class="fas fa-arrow-left mr-1"></i> Trước
</div>
<div class="absolute top-4 right-4 bg-black bg-opacity-70 text-white px-3 py-1 rounded-full text-sm">
Sau <i class="fas fa-arrow-right ml-1"></i>
</div>
</div>
</div>
</div>
</div>
<div class="flex flex-wrap justify-center gap-4 mb-12">
<span class="bg-gray-800 text-teal-400 px-4 py-2 rounded-full font-medium">{{ case.treatment_method }}</span>
<span class="bg-gray-800 text-blue-400 px-4 py-2 rounded-full font-medium">Thẩm mỹ</span>
<span class="bg-gray-800 text-purple-400 px-4 py-2 rounded-full font-medium">Không đau</span>
<span class="bg-gray-800 text-pink-400 px-4 py-2 rounded-full font-medium">{{ case.treatment_duration }}</span>
</div>
{% else %}
<div class="text-center">
<h1 class="text-4xl font-bold mb-6 text-gray-300">Chưa có dữ liệu ca điều trị</h1>
<p class="text-xl text-gray-400">Vui lòng thêm dữ liệu vào dataset để hiển thị ca điều trị.</p>
</div>
{% endif %}
</div>
</section>
<!-- Case Details -->
<section class="py-16 px-4 bg-gray-900 bg-opacity-50">
<div class="container mx-auto">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-12">
<div class="lg:col-span-2">
<h2 class="text-3xl font-bold mb-8 bg-gradient-to-r from-teal-400 to-blue-500 bg-clip-text text-transparent">Chi tiết ca điều trị</h2>
<div class="bg-gray-800 bg-opacity-70 rounded-xl p-6 mb-8 backdrop-filter backdrop-blur-sm">
<h3 class="text-xl font-semibold mb-4 text-teal-400 flex items-center">
<i class="fas fa-clipboard-list mr-2"></i> Tình trạng ban đầu
</h3>
<p class="text-gray-300 mb-4">{{ case.initial_condition }}</p>
<ul class="list-disc pl-6 text-gray-300 space-y-2">
{% for detail in case.initial_details.split(';') %}
<li>{{ detail.strip() }}</li>
{% endfor %}
</ul>
</div>
<div class="bg-gray-800 bg-opacity-70 rounded-xl p-6 mb-8 backdrop-filter backdrop-blur-sm">
<h3 class="text-xl font-semibold mb-4 text-blue-400 flex items-center">
<i class="fas fa-procedures mr-2"></i> Phương pháp điều trị
</h3>
<p class="text-gray-300 mb-4">{{ case.treatment_method }} với các ưu điểm:</p>
<ul class="list-disc pl-6 text-gray-300 space-y-2">
{% for benefit in case.treatment_benefits.split(';') %}
<li>{{ benefit.strip() }}</li>
{% endfor %}
</ul>
</div>
<div class="bg-gray-800 bg-opacity-70 rounded-xl p-6 backdrop-filter backdrop-blur-sm">
<h3 class="text-xl font-semibold mb-4 text-purple-400 flex items-center">
<i class="fas fa-smile-beam mr-2"></i> Kết quả đạt được
</h3>
<p class="text-gray-300 mb-4">Sau khi hoàn thành điều trị, bệnh nhân đạt được:</p>
<ul class="list-disc pl-6 text-gray-300 space-y-2">
{% for result in case.results.split(';') %}
<li>{{ result.strip() }}</li>
{% endfor %}
</ul>
</div>
</div>
<div>
<div class="sticky top-24">
<div class="bg-gray-800 bg-opacity-70 rounded-xl p-6 mb-6 backdrop-filter backdrop-blur-sm">
<h3 class="text-xl font-semibold mb-4 border-b border-gray-700 pb-2">Thông tin ca điều trị</h3>
<div class="space-y-4">
<div>
<p class="text-gray-400 text-sm">Bệnh nhân</p>
<p class="font-medium">{{ case.patient_name }}</p>
</div>
<div>
<p class="text-gray-400 text-sm">Tuổi</p>
<p class="font-medium">{{ case.patient_age }}</p>
</div>
<div>
<p class="text-gray-400 text-sm">Phương pháp</p>
<p class="font-medium text-teal-400">{{ case.treatment_method }}</p>
</div>
<div>
<p class="text-gray-400 text-sm">Số răng điều trị</p>
<p class="font-medium">{{ case.num_teeth }}</p>
</div>
<div>
<p class="text-gray-400 text-sm">Thời gian</p>
<p class="font-medium">{{ case.treatment_duration }}</p>
</div>
<div>
<p class="text-gray-400 text-sm">Độ bền</p>
<p class="font-medium">{{ case.durability }}</p>
</div>
</div>
</div>
<div class="bg-gray-800 bg-opacity-70 rounded-xl p-6 backdrop-filter backdrop-blur-sm">
<h3 class="text-xl font-semibold mb-4 border-b border-gray-700 pb-2">Bác sĩ điều trị</h3>
<div class="flex items-center mb-4">
<div class="w-16 h-16 rounded-full overflow-hidden border-2 border-blue-500 mr-4">
<img src="https://randomuser.me/api/portraits/men/32.jpg" alt="Doctor" class="w-full h-full object-cover">
</div>
<div>
<h4 class="font-bold">{{ case.doctor_name }}</h4>
<p class="text-blue-400">Chuyên gia thẩm mỹ nha khoa</p>
</div>
</div>
<p class="text-gray-300 text-sm">{{ case.doctor_experience }}</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Image Gallery Slider -->
<section class="py-16 px-4 bg-black">
<div class="container mx-auto">
<h2 class="text-3xl font-bold mb-12 text-center bg-gradient-to-r from-teal-400 to-blue-500 bg-clip-text text-transparent">Hình ảnh điều trị</h2>
<div class="relative">
<div class="gallery-slider flex overflow-x-auto snap-x snap-mandatory scroll-smooth rounded-xl shadow-2xl" id="gallery-slider">
{% for image in case.gallery_images.split(',') %}
<div class="gallery-slide flex-shrink-0 w-full">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="bg-gray-900 rounded-xl overflow-hidden">
<img src="{{ image.strip() }}" alt="Before treatment" class="w-full h-96 object-cover">
<div class="p-4 bg-gray-800">
<h4 class="font-semibold text-teal-400">Trước điều trị</h4>
<p class="text-gray-400 text-sm">{{ ['Nhìn thẳng', 'Góc nghiêng', 'Cận cảnh'][loop.index0] }}</p>
</div>
</div>
<div class="bg-gray-900 rounded-xl overflow-hidden">
<img src="{{ image.strip() }}" alt="After treatment" class="w-full h-96 object-cover">
<div class="p-4 bg-gray-800">
<h4 class="font-semibold text-blue-400">Sau điều trị</h4>
<p class="text-gray-400 text-sm">{{ ['Nhìn thẳng', 'Góc nghiêng', 'Cận cảnh'][loop.index0] }}</p>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
<div class="flex justify-center mt-6 space-x-2">
{% for image in case.gallery_images.split(',') %}
<button class="gallery-dot w-3 h-3 rounded-full bg-gray-700 hover:bg-gray-500 transition" data-slide="{{ loop.index0 }}"></button>
{% endfor %}
</div>
<button class="absolute left-4 top-1/2 transform -translate-y-1/2 bg-black bg-opacity-70 text-white p-3 rounded-full hover:bg-opacity-90 transition" id="prev-slide">
<i class="fas fa-chevron-left"></i>
</button>
<button class="absolute right-4 top-1/2 transform -translate-y-1/2 bg-black bg-opacity-70 text-white p-3 rounded-full hover:bg-opacity-90 transition" id="next-slide">
<i class="fas fa-chevron-right"></i>
</button>
</div>
</div>
</section>
<!-- Patient Testimonial -->
<section class="py-16 px-4 bg-gradient-to-br from-gray-900 to-gray-800">
<div class="container mx-auto max-w-4xl">
<div class="bg-gray-800 bg-opacity-70 rounded-xl p-8 md:p-12 backdrop-filter backdrop-blur-sm">
<div class="flex flex-col md:flex-row items-center mb-8">
<div class="md:w-1/4 mb-6 md:mb-0 flex justify-center">
<div class="w-32 h-32 rounded-full overflow-hidden border-4 border-teal-500">
<img src="https://randomuser.me/api/portraits/women/44.jpg" alt="Patient" class="w-full h-full object-cover">
</div>
</div>
<div class="md:w-3/4 md:pl-8 text-center md:text-left">
<h3 class="text-2xl font-bold mb-2">{{ case.patient_name }}</h3>
<p class="text-teal-400 mb-4">Khách hàng hài lòng</p>
<div class="flex justify-center md:justify-start space-x-1 text-yellow-400">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
</div>
</div>
<div class="text-center">
<blockquote class="text-xl italic mb-8">
"{{ case.patient_testimonial }}"
</blockquote>
<div class="flex justify-center space-x-4">
<button class="bg-teal-600 hover:bg-teal-700 text-white px-6 py-3 rounded-full font-medium transition flex items-center">
<i class="fas fa-calendar-check mr-2"></i> Đặt lịch ngay
</button>
<button class="bg-transparent border-2 border-teal-500 text-teal-400 hover:bg-teal-900 hover:bg-opacity-30 px-6 py-3 rounded-full font-medium transition flex items-center">
<i class="fas fa-phone-alt mr-2"></i> 0901.234.567
</button>
</div>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="bg-black py-12 px-4">
<div class="container mx-auto">
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
<div>
<div class="flex items-center mb-4">
<i class="fas fa-tooth text-3xl text-teal-400 mr-3"></i>
<h3 class="text-2xl font-bold bg-gradient-to-r from-teal-400 to-blue-500 bg-clip-text text-transparent">TTL1979</h3>
</div>
<p class="text-gray-400 mb-4">Nha khoa thẩm mỹ hàng đầu Việt Nam với hơn 15 năm kinh nghiệm.</p>
<div class="flex space-x-4">
<a href="#" class="text-gray-400 hover:text-teal-400 transition">
<i class="fab fa-facebook-f"></i>
</a>
<a href="#" class="text-gray-400 hover:text-teal-400 transition">
<i class="fab fa-instagram"></i>
</a>
<a href="#" class="text-gray-400 hover:text-teal-400 transition">
<i class="fab fa-youtube"></i>
</a>
<a href="#" class="text-gray-400 hover:text-teal-400 transition">
<i class="fab fa-tiktok"></i>
</a>
</div>
</div>
<div>
<h4 class="text-lg font-semibold mb-4 text-white border-b border-gray-800 pb-2">Dịch vụ</h4>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-teal-400 transition">Dán sứ Veneer</a></li>
<li><a href="#" class="text-gray-400 hover:text-teal-400 transition">Bọc răng sứ</a></li>
<li><a href="#" class="text-gray-400 hover:text-teal-400 transition">Niềng răng</a></li>
<li><a href="#" class="text-gray-400 hover:text-teal-400 transition">Cấy ghép Implant</a></li>
<li><a href="#" class="text-gray-400 hover:text-teal-400 transition">Tẩy trắng răng</a></li>
</ul>
</div>
<div>
<h4 class="text-lg font-semibold mb-4 text-white border-b border-gray-800 pb-2">Liên hệ</h4>
<ul class="space-y-3 text-gray-400">
<li class="flex items-start">
<i class="fas fa-map-marker-alt mt-1 mr-3 text-teal-400"></i>
<span>123 Nguyễn Văn Linh, Quận 7, TP.HCM</span>
</li>
<li class="flex items-center">
<i class="fas fa-phone-alt mr-3 text-teal-400"></i>
<span>0901.234.567</span>
</li>
<li class="flex items-center">
<i class="fas fa-envelope mr-3 text-teal-400"></i>
<span>info@ttl1979.com</span>
</li>
<li class="flex items-center">
<i class="fas fa-clock mr-3 text-teal-400"></i>
<span>8:00 - 20:00 (T2 - CN)</span>
</li>
</ul>
</div>
<div>
<h4 class="text-lg font-semibold mb-4 text-white border-b border-gray-800 pb-2">Đăng ký nhận tin</h4>
<p class="text-gray-400 mb-4">Nhận thông tin ưu đãi và kiến thức nha khoa hữu ích.</p>
<form class="flex">
<input type="email" placeholder="Email của bạn" class="bg-gray-900 text-white px-4 py-2 rounded-l-lg focus:outline-none focus:ring-2 focus:ring-teal-500 w-full">
<button type="submit" class="bg-teal-600 hover:bg-teal-700 text-white px-4 py-2 rounded-r-lg">
<i class="fas fa-paper-plane"></i>
</button>
</form>
</div>
</div>
<div class="border-t border-gray-800 mt-12 pt-8 flex flex-col md:flex-row justify-between items-center">
<p class="text-gray-500 text-sm mb-4 md:mb-0">© 2023 TTL1979. All rights reserved.</p>
<div class="flex space-x-6">
<a href="#" class="text-gray-500 hover:text-teal-400 text-sm transition">Chính sách bảo mật</a>
<a href="#" class="text-gray-500 hover:text-teal-400 text-sm transition">Điều khoản sử dụng</a>
<a href="#" class="text-gray-500 hover:text-teal-400 text-sm transition">Sitemap</a>
</div>
</div>
</div>
</footer>
<script>
// Mobile menu toggle
const menuToggle = document.getElementById('menu-toggle');
const closeMenu = document.getElementById('close-menu');
const mobileMenu = document.getElementById('mobile-menu');
menuToggle.addEventListener('click', () => {
mobileMenu.classList.remove('hidden');
mobileMenu.classList.add('flex');
});
closeMenu.addEventListener('click', () => {
mobileMenu.classList.add('hidden');
mobileMenu.classList.remove('flex');
});
// Before/After slider
const slider = document.querySelector('.comparison-slider');
const beforeImage = document.querySelector('.before-image');
let isDragging = false;
slider.addEventListener('mousedown', (e) => {
isDragging = true;
document.addEventListener('mousemove', onDrag);
document.addEventListener('mouseup', () => {
isDragging = false;
document.removeEventListener('mousemove', onDrag);
});
});
slider.addEventListener('touchstart', (e) => {
isDragging = true;
document.addEventListener('touchmove', onDrag);
document.addEventListener('touchend', () => {
isDragging = false;
document.removeEventListener('touchmove', onDrag);
});
});
function onDrag(e) {
if (!isDragging) return;
let x;
if (e.type === 'mousemove') {
x = e.clientX;
} else if (e.type === 'touchmove') {
x = e.touches[0].clientX;
}
const containerRect = slider.parentNode.getBoundingClientRect();
let percentage = ((x - containerRect.left) / containerRect.width) * 100;
// Limit between 5% and 95%
percentage = Math.max(5, Math.min(95, percentage));
beforeImage.style.clipPath = `polygon(0 0, ${percentage}% 0, ${percentage}% 100%, 0% 100%)`;
slider.style.left = `${percentage}%`;
}
// Image gallery slider
const gallerySlider = document.getElementById('gallery-slider');
const prevSlide = document.getElementById('prev-slide');
const nextSlide = document.getElementById('next-slide');
const dots = document.querySelectorAll('.gallery-dot');
let currentSlide = 0;
function goToSlide(index) {
currentSlide = index;
gallerySlider.scrollTo({
left: gallerySlider.offsetWidth * index,
behavior: 'smooth'
});
updateDots();
}
function updateDots() {
dots.forEach((dot, index) => {
if (index === currentSlide) {
dot.classList.add('bg-teal-500');
dot.classList.remove('bg-gray-700');
} else {
dot.classList.add('bg-gray-700');
dot.classList.remove('bg-teal-500');
}
});
}
prevSlide.addEventListener('click', () => {
currentSlide = (currentSlide - 1 + dots.length) % dots.length;
goToSlide(currentSlide);
});
nextSlide.addEventListener('click', () => {
currentSlide = (currentSlide + 1) % dots.length;
goToSlide(currentSlide);
});
dots.forEach((dot, index) => {
dot.addEventListener('click', () => {
goToSlide(index);
});
});
// Initialize
updateDots();
</script>
</body>
</html> |