The Tooltip plugin is used to show the details of an element when the user will hover on that element. It will show a small pop-up in the specified position to the element.
You have to use data-toggle="tooltip" attribute and a title in the element. Then It should be initialized with the jquery by calling the tooltip method on the element.
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Tooltip Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<p>hover on the element to see result.</p>
<ul class="list-inline">
<li><a href="#" data-toggle="tooltip" data-placement="top" title="hello!">Top</a></li>
<li><a href="#" data-toggle="tooltip" data-placement="bottom" title="hello!">Bottom</a></li>
<li><a href="#" data-toggle="tooltip" data-placement="left" title="hello!">Left</a></li>
<li><a href="#" data-toggle="tooltip" data-placement="right" title="hello!">Right</a></li>
</ul>
</div>
<script>
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
</script>
</body>
</html>
0 Comment(s)