Skip to content

Instantly share code, notes, and snippets.

@allusis
Created May 19, 2016 23:21
Show Gist options
  • Save allusis/872cc9035c087c891a2848c0aabb7752 to your computer and use it in GitHub Desktop.
Save allusis/872cc9035c087c891a2848c0aabb7752 to your computer and use it in GitHub Desktop.
Custom Bootstrap Popover Content
<a data-toggle="popover" class="popper" data-placement="top">Link</a>
<div class="popover-content hide">
<!-- Content -->
</div
$('.popper').popover({
container: 'body',
html: true,
content: function () {
return $(this).next('.popover-content').html();
}
});
// Close the popover when anything else is clicked
$('body').on('click', function (e) {
$('[data-toggle="popover"]').each(function () {
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment