| 1 |
<!doctype html> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 |
<title>jQuery UI Tooltip - Custom Styling</title> |
| •7 |
<link rel="stylesheet" href="/usr/share/javascript/jquery-ui/css/base/tooltip.css"> |
| 8 |
<link rel="stylesheet" href="../demos.css"> |
| 9 |
<script src="../../external/requirejs/require.js"></script> |
| 10 |
<script src="../bootstrap.js"> |
| 11 |
$( document ).tooltip({ |
| 12 |
position: { |
| 13 |
my: "center bottom-20", |
| 14 |
at: "center top", |
| 15 |
using: function( position, feedback ) { |
| 16 |
$( this ).css( position ); |
| 17 |
$( "<div>" ) |
| 18 |
.addClass( "arrow" ) |
| 19 |
.addClass( feedback.vertical ) |
| 20 |
.addClass( feedback.horizontal ) |
| 21 |
.appendTo( this ); |
| 22 |
} |
| 23 |
} |
| 24 |
}); |
| 25 |
</script> |
| 26 |
<style> |
| 27 |
.ui-tooltip, .arrow:after { |
| 28 |
background: black; |
| 29 |
border: 2px solid white; |
| 30 |
} |
| 31 |
.ui-tooltip { |
| 32 |
padding: 10px 20px; |
| 33 |
color: white; |
| 34 |
border-radius: 20px; |
| 35 |
font: bold 14px "Helvetica Neue", Sans-Serif; |
| 36 |
text-transform: uppercase; |
| 37 |
box-shadow: 0 0 7px black; |
| 38 |
} |
| 39 |
.arrow { |
| 40 |
width: 70px; |
| 41 |
height: 16px; |
| 42 |
overflow: hidden; |
| 43 |
position: absolute; |
| 44 |
left: 50%; |
| 45 |
margin-left: -35px; |
| 46 |
bottom: -16px; |
| 47 |
} |
| 48 |
.arrow.top { |
| 49 |
top: -16px; |
| 50 |
bottom: auto; |
| 51 |
} |
| 52 |
.arrow.left { |
| 53 |
left: 20%; |
| 54 |
} |
| 55 |
.arrow:after { |
| 56 |
content: ""; |
| 57 |
position: absolute; |
| 58 |
left: 20px; |
| 59 |
top: -20px; |
| 60 |
width: 25px; |
| 61 |
height: 25px; |
| 62 |
box-shadow: 6px 5px 9px -9px black; |
| 63 |
-webkit-transform: rotate(45deg); |
| 64 |
-ms-transform: rotate(45deg); |
| 65 |
transform: rotate(45deg); |
| 66 |
} |
| 67 |
.arrow.top:after { |
| 68 |
bottom: -20px; |
| 69 |
top: auto; |
| 70 |
} |
| 71 |
</style> |
| 72 |
</head> |
| 73 |
<body> |
| 74 |
|
| 75 |
<p><a href="#" title="That's what this widget is">Tooltips</a> can be attached to any element. When you hover |
| 76 |
the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.</p> |
| 77 |
<p>But as it's not a native tooltip, it can be styled. Any themes built with |
| 78 |
<a href="http://jqueryui.com/themeroller/" title="ThemeRoller: jQuery UI's theme builder application">ThemeRoller</a> |
| 79 |
will also style tooltips accordingly.</p> |
| 80 |
<p>Tooltips are also useful for form elements, to show some additional information in the context of each field.</p> |
| 81 |
<p><label for="age">Your age:</label> <input id="age" title="We ask for your age only for statistical purposes."></p> |
| 82 |
<p>Hover the field to see the tooltip.</p> |
| 83 |
|
| 84 |
<div class="demo-description"> |
| 85 |
<p>Hover the links above or use the tab key to cycle the focus on each element.</p> |
| 86 |
</div> |
| 87 |
</body> |
| 88 |
</html> |