How to make Bootstrap popover appear/disappear on hover instead of click?
How to make Bootstrap popover appear/disappear on hover instead of click?
To make Bootstrap popover appear/disappear on hover instead of click is done by using the Popover’s trigger Option.
The Bootstrap popover is appearing when you click on the trigger element by default.
So, To show hide the popovers on mouse hover rather than click, This can be simply done 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="https://code.jquery.com/jquery-1.11.2.min.js"></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>