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

93
Views
agregar el evento mouseover al elemento img no funciona

este es mi html

 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <link href="style.css" rel="stylesheet" type="text/css" /> <script src="script.js"></script> </head> <body onload="load();"> <img src="img1.png"> <img src="img2.png"> <img class="img3" src="img3.png"> </body> </html>

Y quiero que la tercera imagen vaya a la izquierda cuando el mouse esté sobre ella. (Tiene posición: absoluta; en ella) usando este código js

 let img; function load(){ img = document.querySelector(".img3"); img.addEventListener("mouseover", mouseover); } function mouseover(){ img.style.left = "0px"; }

pero mouseover nunca se llama. (Comprobado con el registro)

about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

En tu css puedes usar

 .img3:hover{ /* css here */ }

Si usa este método, no necesita usar Javascript para cambiar css al pasar el mouse, ya está integrado en css :)

about 4 years ago · Santiago Gelvez Report

0

puede usar el método hover en css para lograr esto, se vería así:

 .img3:hover { width: *put desired width here*; height: *put desired height here*; }

Es posible que deba usar etiquetas de identificación para hacer que la imagen predeterminada se reduzca cuando ocurra el evento img3:hover. Puede encontrar más información al respecto aquí: https://developer.mozilla.org/en-US/docs/Web/CSS/:hover

about 4 years ago · Santiago Gelvez 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!