Turn boring old element tooltips to prety tooltips, built with CSS3 and get callback api as well.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
This script goes into head section
<!-- Include jQuery Library --> <script src="//code.jquery.com/jquery-1.9.1.js"></script> <script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <!-- Include Tooltip CSS --> <link href="tooltip.css" rel="Stylesheet" type="text/css" /> <!-- Include Tooltip Library --> <script src="tooltip.js" type="text/javascript"> </script> <script type="text/javascript"> $(document).ready( function () { $("#tooltip1").tooltip({ Position: 'top' }); $("#tooltip2").tooltip({ Position: 'left' }); $("#tooltip3").tooltip({ Position: 'right' }); $("#tooltip4").tooltip({ Position: 'bottom' }); $(".tooltip").tooltip({ Position: 'top' }); } ); </script>
HTML Example
<button type="button" id="tooltip1" data-tooltip="Lorem Ipsum is simply dummy text of the printing and typesetting industry." class="btn btn-primary btn-large">Top Tooltip</button> <button type="button" id="tooltip2" data-tooltip="Lorem Ipsum is simply dummy text of the printing and typesetting industry." class="btn btn-primary btn-large">Left Tooltip</button> <button id="tooltip3" type="button" data-tooltip="Lorem Ipsum is simply dummy text of the printing and typesetting industry." class="btn btn-primary btn-large"> Right Tooltip</button> <button type="button" id="tooltip4" data-tooltip="Lorem Ipsum is simply dummy text of the printing and typesetting industry." class="btn btn-primary btn-large">Bottom Tooltip</button>
Option | Default | Description |
---|---|---|
Action | 'hover' |
'hover' | 'scrolltop' | 'scrollcenter' | 'scrollbottom'
Action on which tooltip will show. Scroll action work on window scroll. |
Position | 'top' |
'top' | 'left' | 'right' | 'bottom'
Position tooltip around element. |
Distance |
5
|
Integer
Set Distance of tooltip from the element. |
Effect |
false
|
true | false
Tooltip will shake to make its presence felt. |
OnShow |
null
|
function() { } Callback function on tooltip show. |
OnClose |
null
|
function() { } Callback function on tooltip hide. |