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

161
Vistas
Move image inside div text using hover

I'm trying to imitate this project in jsfiddle and how do I do this hover effect inside my React project without using jquery. Here's my current script tag : <script src="/umi.js"></script> in index.html. Is there any way to implement this effect without having to include <script>? Here's my css code:

.bigTitle{
  font-weight: 800;
  color: transparent;
  font-size:120px;
  background: url("https://phandroid.s3.amazonaws.com/wp-content/uploads/2014/05/rainbow-nebula.jpg") repeat;
  background-position: 40% 50%;
  -webkit-background-clip: text;
  position:relative;
  text-align:center;
  line-height:90px;
  letter-spacing: -8px;
}

I would want the image inside the text to react according to my mouse position.

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

0

const windowWidth = window.innerWidth;
const windowHeight = window.innerHeight;

const mouseMove = (e) => {
  let mouseX, mouseY;
  let traX, traY;
  mouseX = e.pageX;
  mouseY = e.pageY;
  traX = ((4 * mouseX) / 570) + 40;
  traY = ((4 * mouseY) / 570) + 50;
  document.getElementById('bigTitle').style.backgroundPosition = traX + "%" + traY + "%";
}
#bigTitle{
  font-weight: 800;
  color: transparent;
  font-size:120px;
  background: url("https://phandroid.s3.amazonaws.com/wp-content/uploads/2014/05/rainbow-nebula.jpg") repeat;
  background-position: 40% 50%;
  -webkit-background-clip: text;
  position:relative;
  text-align:center;
  line-height:90px;
  letter-spacing: -8px;
}
<div id="bigTitle" onmousemove="mouseMove(event)">It works?</div>

This should do it, I just translated whatever it was in the example you provided in javascript.

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