jQuery Tooltip + Arrow & Interaction
by rtcherry
HTML
<a href="#" title="Oh My!">Link</a>
CSS
@charset"UTF-8";
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size:100%;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after, q:before, q:after {
content:'';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* End HTML5 Reset */
html {
-webkit-font-smoothing: antialiased;
}
.rc-tooltip-default {
border-radius: 5px;
border: 2px solid #000;
background: #4c4c4c;
color: #fff;
}
.rc-tooltip-default .rc-tooltip-content {
font-family: Arial, sans-serif;
font-size: 14px;
line-height: 16px;
padding: 8px 10px;
overflow: hidden;
}
.rc-tooltip-icon {
cursor: help;
margin-left: 4px;
}
.rc-tooltip-base {
padding: 0;
font-size: 0;
line-height: 0;
position: absolute;
z-index: 9999999;
pointer-events: none;
width: auto;
overflow: visible;
}
.rc-tooltip-base .rc-tooltip-content {
overflow: hidden;
}
.rc-tooltip-arrow {
display: block;
text-align: center;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -1;
}
.rc-tooltip-arrow span, .rc-tooltip-arrow-border {
display: block;
width: 0;
height: 0;
position:...
JavaScript
var $element = $('a');
$element.tooltip({
close: function (event, ui) {
var options = $(this).tooltip('option'),
effect = 'fade';
if (typeof options.hide === 'object') {
}
ui.tooltip.stop();
var timeout = null;
timeout = setTimeout(function() {
ui.tooltip[effect + 'Out'].call(ui.tooltip);
}, 400);
ui.tooltip.bind('mouseenter', function(event) {
ui.tooltip[effect + 'In'].call(ui.tooltip);
clearTimeout(timeout);
});
ui.tooltip.bind('mouseleave', function(event) {
ui.tooltip[effect + 'Out'].call(ui.tooltip);
});
},
});