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

112
Views
¿Hay alguna manera de permitir que la imagen emergente se cierre cuando se hace clic en cualquier parte de la pantalla, usando JavaScript y jQuery?

Actualmente, cuando hago clic en una imagen, puede aparecer y cerrarse. Sin embargo, solo se cierra cuando hago clic en la imagen emergente.

Aquí está mi código:

 $(document).ready(eventlistener); function eventlistener() { $(".img-thumbnail").click(popupImage); } function popupImage() { var srcname = $(this).attr("src"); var newImage = srcname.replace("small", "large"); if ($(this).parent().children("span").children("img").hasClass("image-popup")) { $(this).parent().children("span").remove(); } else { var printing = "<span><img class=\"image-popup\"src=\"" + newImage + "\"></img></span>"; $(this).after(printing); }}

Busqué a través de stackoverflow y sé que muchos han hecho esta pregunta y buscaron en Google y lo intentaron pero no pudieron solucionar el problema.

¿Hay alguna manera de modificarlo para permitir que la imagen emergente se cierre cada vez que hago clic en cualquier parte de la pantalla?

Por favor ayuda. Gracias.

about 4 years ago · Juan Pablo Isaza
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!