Skip to content

Instantly share code, notes, and snippets.

@alFReD-NSH
Created December 8, 2013 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alFReD-NSH/7855369 to your computer and use it in GitHub Desktop.
Save alFReD-NSH/7855369 to your computer and use it in GitHub Desktop.
Close popover when the body is clicked on, while using bootstrap popover.
var path = '#thePopoverContent',
element = $('#theButtonThatOpensThePopover')[0];
$(document).click(function (e) {
if (this !== element &&
e.target !== element &&
$('.popover').length &&
!$(e.target).parents(path).length) {
hide();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment