Tooltip Placement with Javascript - HTML CSS Bootstrap

HTML CSS examples for Bootstrap:Tooltip

Description

Tooltip Placement with Javascript

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
 <head> 
  <meta charset="utf-8"> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <title>Example of Bootstrap 3 Tooltip Placement</title> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

  <script type="text/javascript">
$(document).ready(function(){
    $(".tip-top").tooltip({
        placement : 'top'
    });<!--from   ww w  .j av a  2  s  . co m-->
    $(".tip-right").tooltip({
        placement : 'right'
    });
    $(".tip-bottom").tooltip({
        placement : 'bottom'
    });
    $(".tip-left").tooltip({
        placement : 'left'
    });
});
</script> 
  <style type="text/css">
  .bs-example{
      margin: 60px;
    }
</style> 
 </head> 
 <body> 
  <div> 
   <ul class="list-inline"> 
    <li><a href="#" data-toggle="tooltip" class="tip-top" title="Tooltip on the top side">Tooltip on top</a></li> 
    <li><a href="#" data-toggle="tooltip" class="tip-right" title="Tooltip on the right side">Tooltip on right</a></li> 
    <li><a href="#" data-toggle="tooltip" class="tip-bottom" title="Tooltip the on bottom side">Tooltip on bottom</a></li> 
    <li><a href="#" data-toggle="tooltip" class="tip-left" title="Tooltip on the left side">Tooltip on left</a></li> 
   </ul> 
  </div>   
 </body>
</html>

Related Tutorials