How to make Bootstrap popover appear/disappear on hover instead of click

Topic: Bootstrap / Less« Prev|Next »

Answer: Use the Popover's trigger Option

By default, the Bootstrap popover is appearing when you click on the trigger element. However, if you want to show hide the popovers on mouse hover rather than click, you can do this simply by setting the popover's trigger option to hover.

  • <!DOCTYPE html>
  • <html lang="en">
  • <head>
  • <meta charset="UTF-8">
  • <title>Display Bootstrap Popover on Mouse Hover</title>
  • <link rel="stylesheet" href="css/bootstrap.min.css">
  • <link rel="stylesheet" href="css/bootstrap-theme.min.css">
  • <script src=""></script>
  • <script src="js/bootstrap.min.js"></script>
  • <script type="text/javascript">
  • $(document).ready(function(){
  •     $('[data-toggle="popover"]').popover({
  •         placement : 'top',
  •         trigger : 'hover'
  •     });
  • });
  • </script>
  • <style type="text/css">
  •     .bs-example{
  •         margin: 150px 50px;
  •     }
  • </style>
  • </head>
  • <body>
  • <div class="bs-example">
  •     <button type="button" class="btn btn-primary" data-toggle="popover" title="Popover title" data-content="Default popover">Popover</button>
  •     <button type="button" class="btn btn-success" data-toggle="popover" title="Popover title" data-content="Another popover">Another popover</button>
  •     <button type="button" class="btn btn-info" data-toggle="popover" title="Popover title" data-content="A larger popover to demonstrate the max-width of the Bootstrap popover.">Large popover</button>
  •     <button type="button" class="btn btn-warning" data-toggle="popover" title="Popover title" data-content="The last popover!">Last popover</button>
  • </div>
  • </body>
  • </html>

Related FAQ

Here are some more FAQ related to this topic:


Your Feedback:


We would love to hear from you! Please say something.