Bootstrap Tutorial - Popover on top








The following code shows how to popover on top.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.9.1.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
<script type='text/javascript'
  src="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>
<script type='text/javascript'>
$(window).load(function(){<!-- w  ww.  j  a v a  2s. c om-->
$('[data-toggle="popover"]').popover();
$('body').on('click', function (e) {
    $('[data-toggle="popover"]').each(function () {
        if (!$(this).is(e.target) && 
             $(this).has(e.target).length === 0 && 
             $('.popover').has(e.target).length === 0) {
            $(this).popover('hide');
        }
    });
});
});
</script>
</head>
<body style='margin:300px'>
  <div class="bs-example tooltip-demo">
    <div class="bs-example-tooltips">
      <button type="button" 
              class="btn btn-default" 
              data-container="body"
        data-toggle="popover" 
        data-placement="top"
        data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus."
        data-original-title="" title="">Popover on top</button>
    </div>
  </div>
</body>
</html>

Click to view the demo