Tooltips are the small pop up box which appears when user place the mouse on the element or the tooltip is a small description of the action appears in the webpage
<head> <script type="text/javascript"> $(document).ready(function () { $(".tooltip-bar a").tooltip({ placement: 'top' }); }); </script> </head> <body> <h2>Tooltips</h2> <div class="well"> <ul class="tooltip-bar list-inline"> <li><a href="#" class="btn btn-primary" data-toggle="tooltip" data-original-title="Home">DotNetFunda</a></li> <li><a href="#" class="btn btn-danger" data-toggle="tooltip" data-original-title="Tutorials">TechFunda</a></li> <li><a href="#" class="btn btn-warning" data-toggle="tooltip" data-original-title="Online Training">ITFunda</a></li> </ul> </div> </body>
well
in the div, class attribut value tooltip-bar
in the ul element and list-inline
is used to get the values in the line data-toggle
as tooltip and data-original-title
defines the value in the tooltip, the list values are DotNetFunda, TechFunda and ITFunda$(".tooltip-bar a")
calls the function of the body section with placement: 'top'
which gets the tooltip in the top of the button output
Tooltips with delay is used to delay
the tooltip on the page
<head> <script type="text/javascript"> $(document).ready(function () { $(".tooltip-bar a").tooltip({ delay:{show:1000} }); }); </script> </head> <body> <h2>Tooltips with delay</h2> <div class="well"> <ul class="tooltip-bar list-inline"> <li><a href="#" class="btn btn-primary" data-toggle="tooltip" data-original-title="Home">DotNetFunda</a></li> <li><a href="#" class="btn btn-danger" data-toggle="tooltip" data-original-title="Tutorials">TechFunda</a></li> <li><a href="#" class="btn btn-warning" data-toggle="tooltip" data-original-title="Online Training">ITFunda</a></li> </ul> </div> </body>
Tooltips with delay
tooltip-bar
in the ul element and list-inline
is used to get the values in the line data-toggle
as tooltip and data-original-title
defines the value in the tooltip, the list values are DotNetFunda, TechFunda and ITFunda$(".tooltip-bar a")
calls the function of the body section with class attribute tooltip-bar
and delay:{show:1000}
gets the tooltip delay with value 1000output
Title defines value in the tooltip
<script type="text/javascript"> $(document).ready(function () { $(".tooltip-bar a").tooltip({ title: 'Hai Welcome to bootstrap' }); }); </script> </head> <body> <h2>Tooltips with title</h2> <div class="well"> <ul class="tooltip-bar list-inline"> <li><a href="#" class="btn btn-primary" data-toggle="tooltip">DotNetFunda</a></li> <li><a href="#" class="btn btn-danger" data-toggle="tooltip" data-original-title="Tutorials">TechFunda</a></li> <li><a href="#" class="btn btn-warning" data-toggle="tooltip" data-original-title="Online Training">ITFunda</a></li> </ul> </div> </body>
well
in the div and we have class attribute value tooltip-bar
in the ul element and list-inline
is used to get the values in the line data-toggle
as tooltip and, we have given data-original-title
to only li element values TechFunda and ITFunda$(".tooltip-bar a")
calls the function of the body section with class attribute tooltip-bar
and title:"Hai welcome to bootstrap" applies to the li element value DotNetFunda output
Tooltip position is used to place the value in the top, bottom, left and right side
<head> <script type="text/javascript"> $(document).ready(function(){ $(".well-bottom").tooltip({placement:'bottom'}); $(".well-left").tooltip({placement:'left'}); $(".well-top").tooltip({placement:'top'}); $(".well-right").tooltip({placement:'right'}); }); </script> </head> <body> <h2>Tooltips with placement using closing alert</h2> <div class=" alert alert-success"> <div class="well"> <a href="#" class="close" data-dismiss="alert">×</a> <ul class="list-inline"> <li><a href="#" class="btn btn-primary well-bottom" data-toggle="tooltip" data-original-title="Forums">DotNetFunda</a></li> <li><a href="#" class="btn btn-danger well-left" data-toggle="tooltip" data-original-title="Tutorials">TechFunda</a></li> <li><a href="#" class="btn btn-warning well-top" data-toggle="tooltip" data-original-title="Online Training">ITFunda</a></li> <li><a href="#" class="btn btn-success well-right" data-toggle="tooltip" data-original-title="Kids">KidsFunda</a></li> </ul> </div> </div> </body>
alert-success
in the div , we have class attribute value as well
in the div data-dismiss
as alertlist-inline
in the ul element, we have list values in the ul elements with button colors with well bottom, right, left, top
with values dotnetfunda, techfunda, itfunda and KidsFunda with data-toggle as tooltip and data-original-title with given value bottom
, ,welltop
, wellright
, wellleft
, .toolip
calls the body function in the head section output
Tooltips are the actions performed by javascript
<script type="text/javascript"> $(document).ready(function () { $(".show-well").click(function () { $(".tooltip-bar a").tooltip('show'); }); $(".hide-well").click(function () { $(".tooltip-bar a").tooltip('hide'); }); $(".toggle-well").click(function () { $(".tooltip-bar a").tooltip('toggle'); }); $(".destroy-well").click(function () { $(".tooltip-bar a").tooltip('destroy'); }); }); </script> </head> <body> <h2>Tooltips actions</h2> <div class=" alert alert-danger"> <div class="well"> <p class="tooltip-bar"> <a href="#" class="btn btn-default" data-toggle="tooltip" data-original-title="Welcome to Home">Home</a> </p> <div> <p>Below are Tooltip actions from JavaScript</p> <input type="button" class="btn btn-success show-well" value="Show" /> <input type="button" class="btn btn-primary hide-well" value="Hide" /> <input type="button" class="btn btn-warning toggle-well" value="Toggle" /> <input type="button" class="btn btn-danger destroy-well" value="Destroy" /> </div> </div> </div> </body>
alert-danger
, class attribute value as well
in the nother divtooltip-bar
and we have created the tooltip to default button
with value Home
using class attribute value as btn default and data-toggle
as tooltip and data-original-title
as the given value show-well, hide-well, toggle-well, destroy-well
in the buttons function
show-well, hide-well, toggle-well, destroy-well with .tooltip
(show, hide, toggle, destroy) which performs the functions as per given valuesoutp