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

169
Views
Encuentra el objetivo del evento del mouse para la posición en JavaScript

En realidad, no quiero desencadenar un evento. Solo quiero averiguar mediante programación qué elemento manejará el onmousedown si se hace clic con el mouse en la posición x/y.

El propósito es luego agregar un interceptor a ese elemento que point-event: none

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

// without pointer-events: none; const element = document.elementFromPoint(mouseX, mouseY);
 function elementsFromPoint(x, y) { // pointer-events: none; const elements = document.body.getElementsByTagName("*"); var elementsList = Array.prototype.slice.call(elements); var results = [] elementsList.forEach(element => { var rect = element.getBoundingClientRect(); if (rect.left < x && x < rect.right && rect.top < y && y < rect.bottom) { results.push(element) } }); return results; } window.addEventListener('load', () => { const textarea = document.querySelector('#text') document.addEventListener('click', (e) => { const element = elementsFromPoint(e.clientX, e.clientY); console.log(element) }) })
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!