Skip to content

Instantly share code, notes, and snippets.

@allusis
Last active April 21, 2016 04:32
Show Gist options
  • Save allusis/a9f68744ab62c6e6052f47db15b971c5 to your computer and use it in GitHub Desktop.
Save allusis/a9f68744ab62c6e6052f47db15b971c5 to your computer and use it in GitHub Desktop.
Manipulate the Bootstrap popover with data properties
[data-style=help-popover] + .popover {
margin-left:-20px;
}
<div class="helper" id="helper" rel="popover" data-style="help-popover" data-placement="bottom" data-content="Hover over progress indicators for details, and to view the status of each section." data-original-title="See your progress!"></div>
// Destroy the popover when anything is clicked
$('html').on('mouseup', function(e) {
if(!$(e.target).closest('.popover').length) {
$('.popover').each(function(){
$(this.previousSibling).popover('hide');
});
}
});
// Destroy the popover when another is shown
$('body').popover({
selector: '[rel=popover]',
trigger: "hover"
}).on("show.bs.popover", function(e){
$("[rel=popover]").not(e.target).popover("destroy");
$(".popover").remove();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment