Skip to content

Instantly share code, notes, and snippets.

@jeremymouton
Last active December 19, 2015 05:18
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 jeremymouton/5902858 to your computer and use it in GitHub Desktop.
Save jeremymouton/5902858 to your computer and use it in GitHub Desktop.
A better and more user-friendly popover script for Twitter Bootstrap. Easier closing of popover, and only one popover open at one time (to fix overlapping popovers).
$( function() {
$('html').click(function(e) {
$("[rel='popover']").filter(function(index, el) { return el != e.target; }).popover('hide');
});
$("[rel='popover']").popover({
html: true,
trigger: 'manual'
}).click(function(e) {
$("[rel='popover']").filter(function(index, el) { return el != e.target; }).popover('hide');
$(this).popover('toggle');
e.stopPropagation();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment