jQuery UI Tooltip Plugin
May 15th, 2009 by dave Posted in Development, VPR Tags: CSS, JQueryUPDATE: There is now a dedicated page: jQuery vTip.
We’ve looked around for a nice jQuery tooltip plugin and failed to find one that suited us, and we specifically wanted jQuery UI integration so the styling is done using whatever theme you are rolling.
To use it attach a class of vtip to any element, and give it a title. For example, <a href=”test.html” class=”vtip” title=”This is the tooltip!”>Link</a>.
Here’s the code, feel free to use it and drop us a backlink if you care:
/**
Vertigo Tip by www.vertigo-project.com
Requires (kind of) jQuery UI, and (definately) jQuery
*/
this.vtip = function() {
xOffset = 5; // x distance from mouse
yOffset = 20; // y distance from mouse
$(".vtip").hover(
function(e) {
this.t = this.title;
this.title = ''; //stop the actual title showing
$('body').append( '
' + this.t + '
' );
$('p#vtip').css("display", "none") //hide it
.css("position", "absolute").css("opacity", "0.9").css("padding", "10px") //style
.css("top", (e.pageY + yOffset) + "px").css("left", (e.pageX + xOffset) + "px") //position
.fadeIn("fast"); //show it
},
function() {
this.title = this.t; // set the title back
$("p#vtip").remove();
}
).mousemove(
function(e) {
$("p#vtip").css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
}
);
};
jQuery(document).ready(function($) {
vtip();
})

![jQuery UI Tooltip Plugin Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=52e3aa73-6597-445c-9777-9ae6a10431be)



































RSS
Congratulations!
How do I use the function, just have a title tag with class and vtip, if any does not work.
Hi Bruno,
Thats correct as long as you have a title and a class of vtip it should work. Make sure it’s included after the latest jQuery and jQuery UI are though.
If you’re in firefox you can hold CTRL+SHIFT+J to get the debug window which might help
Cheers
Dave
Updated it today with better IE/Chrome support. Should be 100% cross browser compatible now.
Great plugin… have you ever consider adding on click functionality, aside from just hover??
tip arrow not displaying properly ,cursor arrow covers over it, you may add some margin
Great Plugin!
We are planning to use it in our Form 1040NR-EZ Tax Software
https://www.visataxes.com/software/forms/Form1040NR-EZ.php
Thanks
@viva uyghurs
You can change the x and y offset to move it off the cursor or to where ever you want it. It’s the first declaration in the vtip.js.
Great little tooltip. Light, clean, and easy to use.
Thank you!!
Really light and quick tip. Great job. Thanks