Setting Show/Hide Time Delay for Popovers - HTML CSS Bootstrap

HTML CSS examples for Bootstrap:Popover

Description

Setting Show/Hide Time Delay for Popovers

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 Setting Show/Hide Time Delay for Bootstrap 3 Popovers</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(){
    // Showing and hiding popover with same speed
    $(".popover-tiny").popover({
        delay: 500<!--  w  w w.  j  a v a2s . c om-->
    });
    
    // Showing and hiding popover with different speed
    $(".popover-large").popover({
        delay: {show: 0, hide: 2000}
    }); 
});
</script> 
  <style type="text/css">
  .bs-example{
      margin: 150px 50px;
    }
  .button{
      margin: 5px;
    }
</style> 
 </head> 
 <body> 
  <div> 
   <button type="button" class="btn btn-default popover-tiny" title="Popover Delay Demo" data-content="A small popover that show and hide after 500 milliseconds.">Popover Tiny</button> 
   <button type="button" class="btn btn-primary popover-large" title="Popover Delay Demo" data-content="A large popover that displayed instantly on button click but hide after 2000 milliseconds after clicking the button once again.">Popover Large</button> 
  </div>   
 </body>
</html>

Related Tutorials