Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
How do I make it were the outside of my png image cannot be clicked and only the actual "image" part can be clicked?

Please help I have struggled on this with my cookie clicker-like game and I can't figure it out.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Sounds like 'event delegation' would be useful Assuming your image includes some distinguishing factor (className or id); Basically add an event listener to the whole container/window and observe if className matches with your image else do nothing

const imageClickObserver = (e) => {
  if(e.target.className === 'image') {
   cookiePoints++;
   alert('clicked on image')
 }else {
   return;
 }
}

window.addEventListener('click' imageClickObserver)

If I misunderstood your question and all you care of is to make your elements 'clickable'/'not clickable' then you can read this thread. Add CSS cursor property when using "pointer-events: none"

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda