Popover Methods popover('toggle') - HTML CSS Bootstrap

HTML CSS examples for Bootstrap:Popover

Description

Popover Methods popover('toggle')

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 Methods</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(){
    $(".show-popover").click(function(){
       $("#myPopover").popover('show');
    });<!--  w w  w  .ja v  a  2s. c  o  m-->
    $(".hide-popover").click(function(){
       $("#myPopover").popover('hide');
    });
    $(".toggle-popover").click(function(){
       $("#myPopover").popover('toggle');
    });
    $(".destroy-popover").click(function(){
       $("#myPopover").popover('destroy');
    });
});
</script> 
  <style type="text/css">
  .bs-example{
      margin: 100px 50px;
    }
  .popover-examples{
    margin-bottom: 60px;
  }
</style> 
 </head> 
 <body> 
  <div> 
   <div class="popover-examples"> 
    <button type="button" title="Popover title" class="btn btn-primary btn-lg" id="myPopover" data-toggle="popover" data-content="And here's some amazing content. It's very engaging.">Popover Example</button> 
   </div> 
   <div class="popover-controls"> 
    <p>Click on the following buttons to control the popover manually.</p> 
    <input type="button" class="btn btn-info show-popover" value="Show"> 
    <input type="button" class="btn btn-warning hide-popover" value="Hide"> 
    <input type="button" class="btn btn-success toggle-popover" value="Toogle"> 
    <input type="button" class="btn btn-danger destroy-popover" value="Destroy"> 
   </div> 
  </div>   
 </body>
</html>

Related Tutorials