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

182
Views
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 answers
Answer question

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 Report
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!