Changing the position of Bootstrap popovers based on the popover’s X position in relation to window edge?

I just noticed that the placement option could either be a string or a function returning a string that makes the calculation each time you click on a popover-able link. This makes it real easy to replicate what you did without the initial $.each function: var options = { placement: function (context, source) { var … Read more

Contain form within a bootstrap popover?

I would put my form into the markup and not into some data tag. This is how it could work: JS Code: $(‘#popover’).popover({ html : true, title: function() { return $(“#popover-head”).html(); }, content: function() { return $(“#popover-content”).html(); } }); HTML Markup: <a href=”#” id=”popover”>the popover link</a> <div id=”popover-head” class=”hide”> some title </div> <div id=”popover-content” class=”hide”> … Read more

How to dismiss a Twitter Bootstrap popover by clicking outside?

Update: A slightly more robust solution: http://jsfiddle.net/mattdlockyer/C5GBU/72/ For buttons containing text only: $(‘body’).on(‘click’, function (e) { //did not click a popover toggle or popover if ($(e.target).data(‘toggle’) !== ‘popover’ && $(e.target).parents(‘.popover.in’).length === 0) { $(‘[data-toggle=”popover”]’).popover(‘hide’); } }); For buttons containing icons use (this code has a bug in Bootstrap 3.3.6, see the fix below in this … Read more