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
Javascript moviendo el elemento a la posición del clic del mouse, el elemento no responde

Estoy tratando de hacer que mi png se mueva a la posición de clic del mouse cuando el usuario hace clic dentro del contenedor, pero no puedo hacer que el png responda. Estoy siguiendo este tutorial ( https://www.youtube.com/watch?v=b4GwvdhrEQg ) y me quedé en la primera prueba. mi destino no responde a los clics en absoluto. Por favor ayuda

 var theGirl = document.querySelector("#girl"); var container = document.querySelector("#floor"); container.addEventListener("click", getClickPosition, false); function getClickPosition(e) { var xPosition = e.clientX - (theGirl.offsetWidth / 2); var yPosition = e.clientY; - (theGirl.offsetHeight / 2) var translate3dValue = "translate3d(" + xPosition + "px" + yPosition + "px, 0)"; theGirl.style.transform = translate3dValue; }
 #floor { width: 700px; height: 600px; cursor: pointer; overflow: visible; border: 10px #EDEDED solid; } #girl { height: 450px; width: 200px; border: 15px red solid; transform: translate3d(50px, 50px, 0); }
 <body> <div id="floor"> <div> <img src="girl.png" id="girl"> </div> </div>

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!