elohimdavid commited on
Commit
bfa9ffb
·
verified ·
1 Parent(s): 7df62d8

PROMPT EXACTO PARA ACTIVAR GALERÍAS CLICKEABLES EN CADA PROYECTO

Browse files

Configura todas las secciones de proyectos para que cada imagen sea clickeable y se abra en una galería tipo lightbox o slider. No cambies la estructura actual de la página, solo mejora la funcionalidad de las imágenes.

Instrucciones específicas:

Cada proyecto debe comportarse como una galería independiente.

Al hacer clic en cualquier imagen de un proyecto, debe abrirse una vista ampliada con navegación tipo slider (siguiente / anterior).

Mantén el diseño limpio y minimalista, sin bordes ni sombras fuertes.

Asegúrate de que la experiencia sea fluida en desktop y mobile.

No modifiques el contenido, categorías, ni textos. Solo aplica esta funcionalidad a todas las imágenes del portafolio.

Mantén el estilo visual premium y coherente con el branding.

Resultado esperado:
Todas las imágenes de proyectos deben verse en una galería elegante al hacer clic, permitiendo navegar entre todas las fotos de ese proyecto sin salir de la página.

Files changed (3) hide show
  1. portfolio.html +8 -9
  2. script.js +81 -0
  3. style.css +78 -12
portfolio.html CHANGED
@@ -46,16 +46,15 @@
46
  <div id="remodelacion-ogando" class="mb-20">
47
  <h2 class="font-playfair text-3xl mb-8">Remodelación Ogando</h2>
48
  <p class="text-lg mb-8">Cliente encantado con el resultado. Siempre comprometidos a brindar el mejor servicio.</p>
49
-
50
- <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
51
- <img src="https://i.ibb.co/1tvWTjfG/525612442-17864987004429118-940891088380467670-n.jpg" alt="Remodelación Ogando" class="w-full h-auto">
52
- <img src="https://i.ibb.co/1JXkZ6mG/525194113-17864987013429118-8162271928019079903-n.jpg" alt="Remodelación Ogando" class="w-full h-auto">
53
- <img src="https://i.ibb.co/QF45V7xg/526298284-17864987022429118-6449377605194988325-n.jpg" alt="Remodelación Ogando" class="w-full h-auto">
54
- <img src="https://i.ibb.co/XTLHKCG/524817704-17864987043429118-6565424464586946703-n.jpg" alt="Remodelación Ogando" class="w-full h-auto">
55
- <img src="https://i.ibb.co/VcqQf34D/525557104-17864987070429118-806591355429717053-n.jpg" alt="Remodelación Ogando" class="w-full h-auto">
56
- <img src="https://i.ibb.co/z9fKkFW/525137468-17864987061429118-8382930422169636023-n.jpg" alt="Remodelación Ogando" class="w-full h-auto">
57
  </div>
58
- </div>
59
 
60
  <!-- Viviendas Económicas -->
61
  <div id="viviendas-economicas" class="mb-20">
 
46
  <div id="remodelacion-ogando" class="mb-20">
47
  <h2 class="font-playfair text-3xl mb-8">Remodelación Ogando</h2>
48
  <p class="text-lg mb-8">Cliente encantado con el resultado. Siempre comprometidos a brindar el mejor servicio.</p>
49
+ <div class="project-gallery grid md:grid-cols-2 lg:grid-cols-3 gap-6">
50
+ <img src="https://i.ibb.co/1tvWTjfG/525612442-17864987004429118-940891088380467670-n.jpg" alt="Remodelación Ogando">
51
+ <img src="https://i.ibb.co/1JXkZ6mG/525194113-17864987013429118-8162271928019079903-n.jpg" alt="Remodelación Ogando">
52
+ <img src="https://i.ibb.co/QF45V7xg/526298284-17864987022429118-6449377605194988325-n.jpg" alt="Remodelación Ogando">
53
+ <img src="https://i.ibb.co/XTLHKCG/524817704-17864987043429118-6565424464586946703-n.jpg" alt="Remodelación Ogando">
54
+ <img src="https://i.ibb.co/VcqQf34D/525557104-17864987070429118-806591355429717053-n.jpg" alt="Remodelación Ogando">
55
+ <img src="https://i.ibb.co/z9fKkFW/525137468-17864987061429118-8382930422169636023-n.jpg" alt="Remodelación Ogando">
 
56
  </div>
57
+ </div>
58
 
59
  <!-- Viviendas Económicas -->
60
  <div id="viviendas-economicas" class="mb-20">
script.js CHANGED
@@ -11,6 +11,87 @@ document.addEventListener('DOMContentLoaded', function() {
11
  background.classList.add('no-video');
12
  }
13
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  // Smooth scrolling for anchor links
15
  document.querySelectorAll('a[href^="#"]').forEach(anchor => {
16
  anchor.addEventListener('click', function (e) {
 
11
  background.classList.add('no-video');
12
  }
13
  });
14
+
15
+ // Lightbox Gallery Functionality
16
+ const initLightbox = () => {
17
+ const lightbox = document.createElement('div');
18
+ lightbox.id = 'lightbox';
19
+ lightbox.innerHTML = `
20
+ <div class="lightbox-content">
21
+ <span class="close">&times;</span>
22
+ <img src="" alt="" class="lightbox-img">
23
+ <div class="lightbox-nav">
24
+ <button class="prev">&#10094;</button>
25
+ <button class="next">&#10095;</button>
26
+ </div>
27
+ </div>
28
+ `;
29
+ document.body.appendChild(lightbox);
30
+
31
+ const images = document.querySelectorAll('.project-gallery img');
32
+ const lightboxImg = lightbox.querySelector('.lightbox-img');
33
+ const closeBtn = lightbox.querySelector('.close');
34
+ const prevBtn = lightbox.querySelector('.prev');
35
+ const nextBtn = lightbox.querySelector('.next');
36
+ let currentIndex = 0;
37
+ let currentGallery = [];
38
+
39
+ images.forEach((img, index) => {
40
+ img.addEventListener('click', (e) => {
41
+ e.preventDefault();
42
+ currentGallery = Array.from(img.closest('.project-gallery').querySelectorAll('img'));
43
+ currentIndex = currentGallery.indexOf(img);
44
+ lightbox.style.display = 'flex';
45
+ lightboxImg.src = img.src;
46
+ lightboxImg.alt = img.alt;
47
+ document.body.style.overflow = 'hidden';
48
+ });
49
+ });
50
+
51
+ const updateLightbox = () => {
52
+ lightboxImg.src = currentGallery[currentIndex].src;
53
+ lightboxImg.alt = currentGallery[currentIndex].alt;
54
+ };
55
+
56
+ prevBtn.addEventListener('click', () => {
57
+ currentIndex = (currentIndex - 1 + currentGallery.length) % currentGallery.length;
58
+ updateLightbox();
59
+ });
60
+
61
+ nextBtn.addEventListener('click', () => {
62
+ currentIndex = (currentIndex + 1) % currentGallery.length;
63
+ updateLightbox();
64
+ });
65
+
66
+ closeBtn.addEventListener('click', () => {
67
+ lightbox.style.display = 'none';
68
+ document.body.style.overflow = 'auto';
69
+ });
70
+
71
+ lightbox.addEventListener('click', (e) => {
72
+ if (e.target === lightbox) {
73
+ lightbox.style.display = 'none';
74
+ document.body.style.overflow = 'auto';
75
+ }
76
+ });
77
+
78
+ document.addEventListener('keydown', (e) => {
79
+ if (lightbox.style.display === 'flex') {
80
+ if (e.key === 'Escape') {
81
+ lightbox.style.display = 'none';
82
+ document.body.style.overflow = 'auto';
83
+ } else if (e.key === 'ArrowLeft') {
84
+ currentIndex = (currentIndex - 1 + currentGallery.length) % currentGallery.length;
85
+ updateLightbox();
86
+ } else if (e.key === 'ArrowRight') {
87
+ currentIndex = (currentIndex + 1) % currentGallery.length;
88
+ updateLightbox();
89
+ }
90
+ }
91
+ });
92
+ };
93
+
94
+ initLightbox();
95
  // Smooth scrolling for anchor links
96
  document.querySelectorAll('a[href^="#"]').forEach(anchor => {
97
  anchor.addEventListener('click', function (e) {
style.css CHANGED
@@ -147,21 +147,87 @@ video {
147
  .strategic-form-card p {
148
  @apply mb-6 flex-grow;
149
  }
150
- /* Project card styles */
151
- .project-card {
152
- @apply relative overflow-hidden h-96;
153
  }
154
 
155
- .project-card img {
156
- @apply w-full h-full object-cover transition-transform duration-500;
157
  }
158
- .project-card:hover img {
159
- @apply scale-105;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  }
161
 
162
- .project-overlay {
163
- @apply absolute inset-0 bg-[#5b95ef] bg-opacity-80 flex items-end p-6 opacity-0 transition-opacity duration-300;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  }
165
- .project-card:hover .project-overlay {
166
- @apply opacity-100;
167
- }
 
147
  .strategic-form-card p {
148
  @apply mb-6 flex-grow;
149
  }
150
+ /* Project gallery styles */
151
+ .project-gallery {
152
+ @apply grid gap-4;
153
  }
154
 
155
+ .project-gallery img {
156
+ @apply w-full h-auto cursor-pointer transition-opacity duration-300;
157
  }
158
+
159
+ .project-gallery img:hover {
160
+ @apply opacity-90;
161
+ }
162
+
163
+ /* Lightbox styles */
164
+ #lightbox {
165
+ display: none;
166
+ position: fixed;
167
+ top: 0;
168
+ left: 0;
169
+ width: 100%;
170
+ height: 100%;
171
+ background-color: rgba(0, 0, 0, 0.9);
172
+ z-index: 9999;
173
+ align-items: center;
174
+ justify-content: center;
175
+ }
176
+
177
+ .lightbox-content {
178
+ position: relative;
179
+ max-width: 90%;
180
+ max-height: 90%;
181
  }
182
 
183
+ .lightbox-img {
184
+ max-height: 80vh;
185
+ max-width: 90vw;
186
+ object-fit: contain;
187
+ }
188
+
189
+ .close {
190
+ position: absolute;
191
+ top: 15px;
192
+ right: 15px;
193
+ color: white;
194
+ font-size: 35px;
195
+ font-weight: bold;
196
+ cursor: pointer;
197
+ }
198
+
199
+ .lightbox-nav {
200
+ position: absolute;
201
+ width: 100%;
202
+ top: 50%;
203
+ transform: translateY(-50%);
204
+ display: flex;
205
+ justify-content: space-between;
206
+ padding: 0 20px;
207
+ }
208
+
209
+ .lightbox-nav button {
210
+ background: none;
211
+ border: none;
212
+ color: white;
213
+ font-size: 40px;
214
+ cursor: pointer;
215
+ opacity: 0.7;
216
+ transition: opacity 0.3s;
217
+ }
218
+
219
+ .lightbox-nav button:hover {
220
+ opacity: 1;
221
+ }
222
+
223
+ @media (max-width: 768px) {
224
+ .lightbox-nav button {
225
+ font-size: 30px;
226
+ }
227
+
228
+ .close {
229
+ font-size: 30px;
230
+ top: 10px;
231
+ right: 10px;
232
+ }
233
  }