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

323
Views
¿Cómo mostrar un div cerca de la posición del cursor al pasar el mouse en React js?

Tengo dos elementos de texto, item1 y item2, y un div con algo de texto dentro. Quiero mantener el div oculto de forma predeterminada, pero mostrarlo en la posición del cursor cuando paso el cursor sobre el elemento de texto 1 o el elemento 2. Consulte la animación GIF de muestra en este enlace

Intenté esto en código Jquery dentro de React. Pero da 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 answers
Answer question

0

Prueba esto:

 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 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!