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

253
Vistas
How to make a draggable image appear on link hover?

How to make a draggable image appear on link hover? Just like in this website

I will post some more images: enter image description here

enter image description here enter image description here

I am using React, so if it works with a library, i will be happy to take recommendations

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You must present what you have done till now, so we can help. consider this for your next questions. Btw you can use something like this:

document.querySelectorAll(".item").forEach((element) => {
  element.addEventListener("mousemove", (e) => {
    const img = e.currentTarget.querySelector("img");
    const {
      x,
      y,
      width,
      height
    } = e.currentTarget.getBoundingClientRect();
    img.style.display = "block";
    img.style.transform = `translate(${e.pageX - img.clientWidth / 2 - x}px,${
      e.pageY - img.clientHeight / 2 - y
    }px)`;

    if (
      e.pageX > width + x ||
      e.pageY > height + y ||
      e.pageX < x ||
      e.pageY < y
    ) {
      img.style.display = "none";
    }
  });

  element.addEventListener("mouseleave", (e) => {
    const img = e.currentTarget.querySelector("img");
    img.style.display = "none";
  });
});
.item {
  display: block;
  position: relative;
  background-color: tomato;
}

* {
  padding: 0;
  margin: 0;
}

body {
  padding-top: 50px;
}

a {
  text-decoration: none;
  color: black;
  font-size: 2rem;
}

a:active,
a:focus,
a:hover {
  cursor: none;
}

.title {
  overflow: hidden;
  max-width: 100%;
}

.item img {
  display: none;
  max-width: 220px;
  position: absolute;
  top: 0;
  left: 0;
}

.item {
  margin-top: 20px;
  background-color: cadetblue;
}
<a class="item" href="#">
  <h3 class="title">Title</h3>
  <img src="https://kulbachny.com/wp-content/uploads/2021/01/jg-cosmos.jpg" />
</a>

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