Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

180
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda