I am not able to open the tooltip post closing the same by clicking outside the button. Appreciate the help.
Below are the ways to reproduce the issue
- Click on the button
- Click outside of button to close the tooltip
- Click the button again to open the tooltip
Note : Button requires two clicks to open the tooltip post-closing by clicking outside of the div.
Below is the source code.
<!DOCTYPE html>
<html lang="en">
<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 Container for Bootstrap 3 Popover</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(){
// Append popover HTML to wrapper element
$("#myPopovers a").popover({
container: '.wrapper'
});
});
</script>
<script>
$(document).mouseup(function (e){
var container = $(".popover");
if (!container.is(e.target) && container.has(e.target).length === 0){
container.fadeOut();
}
});
</script>
<style type="text/css">
.bs-example {
margin: 150px 50px;
}
.bs-example a {
margin: 5px;
}
</style>
</head>
<body>
<div class="bs-example">
<div class="wrapper">
<div id="myPopovers"> <a href="#" class="btn btn-primary" data-toggle="popover" title="Popover title" data-content="Default popover">Popover</a> </div>
</div>
</div>
</body>
</html>