Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
Lightbox muestra la misma imagen para cualquier imagen en la que haga clic

He configurado una caja de luz JS con 6 imágenes diferentes. Cuando hago clic en una imagen, aparece la misma imagen en el cuadro de luz, en lugar de la imagen en la que hice clic. La imagen que se muestra cada vez es la última imagen de las que tienen la etiqueta '.service_img'. ¿Hay algún tipo de JS que pueda agregar para que muestre la imagen en la que hago clic, en lugar de la misma cada vez?

 const lightbox = document.createElement('div') lightbox.id = 'lightbox' document.body.appendChild(lightbox) function openLightbox(){ const images = document.querySelectorAll('.service_img'); images.forEach(image => { lightbox.classList.add('active'); const img = document.createElement('img') img.src = image.src while (lightbox.firstChild){ lightbox.removeChild(lightbox.firstChild) } lightbox.appendChild(img) }) } lightbox.addEventListener('click', e => { if (e.target !== e.currentTarget) return lightbox.classList.remove('active') })

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!