Created
March 26, 2014 10:06
-
-
Save setola/9780121 to your computer and use it in GitHub Desktop.
How to add a close button to the Twitter Bootstrap Popover feature
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
<a | |
id="children-age-toggler" | |
data-target-selector="#children-age" | |
data-placement="bottom" | |
href="javascript:;" | |
class="children-age popover-children" | |
data-title="Children's Age" | |
></a> | |
<div id="children-age" class="hidden"> | |
<p>Please select your children's Age</p> | |
<!-- put here more html forms and stuff --> | |
</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
// Popover for the quick search additional fields | |
jQuery('.popover-test').popover({ | |
html : true, | |
content: function() { | |
return $(jQuery(this).data('target-selector')).html(); | |
}, | |
title: function(){ | |
return jQuery(this).data('title')+'<span class="close">×</span>'; | |
} | |
}).on('shown.bs.popover', function(e){ | |
var popover = jQuery(this); | |
jQuery(this).parent().find('div.popover .close').on('click', function(e){ | |
popover.popover('hide'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment