The site has links with tooltips with dynamic content. I am using jquery UI Tooltip to display them. I would not want every time user accidentally holds the cursor over the link display the tooltip. I want show tooltip only if it delays the cursor over the link for a few seconds. It`s should work like in Gmail, when you hover on sender name you see info about him (see picture).
I needed tooltip, which user can interact with, so i use this code (Thanks to Antonimo https://stackoverflow.com/a/15014759/274417)
$( document ).tooltip({
show: null, // show immediately
items: 'input',
hide: {
effect: "", // fadeOut
},
open: function( event, ui ) {
ui.tooltip.animate({ top: ui.tooltip.position().top + 10 }, "fast" );
},
close: function( event, ui ) {
ui.tooltip.hover(
function () {
$(this).stop(true).fadeTo(400, 1);
//.fadeIn("slow"); // doesn't work because of stop()
},
function () {
$(this).fadeOut("400", function(){ $(this).remove(); })
}
);
}
});
Example here (you can see all this mess when mouse hovering on elements with tooltips)
How to do it better? Use timeOut? Or maybe i should use the hoverIntent plugin? But how it will be coded?