Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

144
Vistas
How to add mouseover event listner to show that Im hovering over a particular image?

so I have used a img tag inside a list tag and I want to use a mouse over event to show on which image Im hovering above

<div class="imgBox"><img src="" alt="" /></div>
<ul class="Thumbnail" id="thumbnail">
  <li>
    <a href="img1.jpg" target="imgBox"
      ><img src="img1.jpg" width="120px"
    /></a>
  </li>
  <li>
    <a href="img2.jpg" target="imgBox"
      ><img src="img2.jpg" width="120px"
    /></a>
  </li>
  <li>
    <a href="img3.jpg" target="imgBox"
      ><img src="img3.jpg" width="120px"
    /></a>
  </li>
  <li>
    <a href="img4.jpg" target="imgBox"
      ><img src="img4.jpg" width="120px"
    /></a>
  </li>
  <li>
    <a href="img5.jpg" target="imgBox"
      ><img src="img5.jpg" width="120px"
    /></a>
  </li>
</ul
about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

You could use onmouseover html native event on your image element like this

<img onmouseover="yourfunction(this)">

doc

about 4 years ago · Juan Pablo Isaza Denunciar

0

It's worth noting the mouseover event bubbles. If you choose to use this you can just set a single mouseover event listener on the parent element (the <ul>) rather than setting event listeners on every image.

You can do this as follows...

document.getElementById("thumbnail").addEventListener("mouseover", outputImage);

function outputImage(e) {
  e.target.style.borderColor = "// desired color";
}

If you are unfamiliar with event bubbling and capturing, please refer to this SO thread.

Edit: Now that you've mentioned your goal is to change the border color, consider the :hover CSS pseudo-class as others have mentioend.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can add "onmouseover ="function(parameter)" to your HTML img element. With this you can point to a JavaScript function that executes whenever you hover over that element.

This page explains how to do so

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda