Last active
April 21, 2016 04:32
-
-
Save allusis/a9f68744ab62c6e6052f47db15b971c5 to your computer and use it in GitHub Desktop.
Manipulate the Bootstrap popover with data properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[data-style=help-popover] + .popover { | |
margin-left:-20px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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