here is the jquery code:
This simply adds the X button to the upper right corner:
var isVisible = false; var clickedAway = false; $('.btn-danger').popover({ html: true, trigger: 'manual' }).click(function(e) { $(this).popover('show'); $('.popover-title').append('<button type="button" class="close">×</button>'); clickedAway = false isVisible = true e.preventDefault() }); $(document).click(function(e) { if(isVisible & clickedAway) { $('.btn-danger').popover('hide') isVisible = clickedAway = false } else { clickedAway = true } });
And this one closes the popup only when you press the X button:
$('.btn-danger').popover({ html: true, trigger: 'manual' }).click(function(e) { $(this).popover('show'); $('.popover-title').append('<button type="button" class="close">×</button>'); $('.close').click(function(e){ $('.btn-danger').popover('hide'); }); e.preventDefault(); });
source share