I am trying to create a tooltip for a navigation bar, the code is below.
I’d like to have the div follow the mouse cursor, which function is needed to achieve this?
$('div#navigation a').hover(function() {
$('div#tooltip').fadeIn(500)
}, function() {
$('div#tooltip').fadeOut(100)
});
On
mousemoveget the mouseeventcoordinatespageXandpageYTooltip on hover using jQuery
Here’s a basic plugin example
Note: you might want to further improve on that code restricting the position of the tooltip to the viewport boundaries, you got the idea.