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

321
Vistas
How to Show a div near Cursor position on hover in React js?

I have two Text Items, item1 and item2, and a div with some text inside. I want to keep the div hidden by default but show it at cursor position when I hover on Text item1 or item2. Please check the sample GIF animation in this Link

I tried this in Jquery code inside React. But it gives error.

$(".text-item").mouseenter(function (e) {
  $(".box")
    .css({
      position: "absolute",
      right: e.pageX,
      top: e.pageY,
      display: "block",
    })
    .show();
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try this:

import {useState, Fragment} from react;

const [visible, setVisible] = useState(false)

const MyApp = ()=> {
  return ( 
      <Fragment> {
         visible && 
         <div className="hiddenContainer>
            <p>Your hidden text</p>
         </div>
      }
      </Fragment>
      <p onMouseEnter={()=>setVisible(!visible)}>Item 1</p>
      <p onMouseEnter={()=>setVisible(!visible)}>Item 2</p>
    )
  }
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