Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 31, 2022 08:59 am GMT

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: https://i.stack.imgur.com/e4lpB.gif

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();
});


Original Link: https://dev.to/naeemrind/how-to-show-a-div-near-cursor-position-on-hover-in-react-js-454

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To