Popover Placement with Javascript method - HTML CSS Bootstrap

HTML CSS examples for Bootstrap:Popover

Description

Popover Placement with Javascript method

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 Popover 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(){
    $(".popover-top").popover({
        placement : 'top'
    });<!--from w  w  w .  ja v a  2  s  .  c om-->
    $(".popover-right").popover({
        placement : 'right'
    });
    $(".popover-bottom").popover({
        placement : 'bottom'
    });
    $(".popover-left").popover({
        placement : 'left'
    });
});
</script> 
  <style type="text/css">
  .bs-example{
      margin: 150px 50px;
    }
  .popover-demo{
        margin-bottom: 20px;
    }
</style> 
 </head> 
 <body> 
  <div> 
   <div class="popover-demo"> 
    <button type="button" class="btn btn-primary popover-top" data-toggle="popover" title="Popover title" data-content="Default popover">Popover on top</button> 
    <button type="button" class="btn btn-success popover-right" data-toggle="popover" title="Popover title" data-content="Popover on right.">Popover on right</button> 
    <button type="button" class="btn btn-info popover-bottom" data-toggle="popover" title="Popover title" data-content="Popover on bottom.">Popover on bottom</button> 
    <button type="button" class="btn btn-warning popover-left" data-toggle="popover" title="Popover title" data-content="Popover on left.">Popover on left</button> 
   </div> 
   <p><strong>Note:</strong> Click on the buttons to display the popover.</p> 
  </div>   
 </body>
</html>

Related Tutorials