Is there a way to prevent the bootstrap popover from moving away from the triggering element when the window is resized?
What CSS should be used to position the tip of the popover near the top corner instead of on the left?
Despite setting the placement as 'auto right', the popover is still appearing on the left side. Any insights on how to fix this?
$(function () {
$('.js-tooltip-trigger').popover({
html: true,
trigger: 'focus',
placement: 'auto right',
content: function (e) {
return $(this).parent(".form-group").find(".js-tooltip").html();
}
}).on('shown.bs.popover', function () {
$('.popover').css('top',parseInt($('.popover').css('top')) + 22 + 'px')
});
});
The HTML:
<div class="form-group">
<label for="ref">Reference</label>
<input type="text" class="form-control js-tooltip-trigger" id="ref" maxlength="50" >
<div class="js-tooltip" style="display: none;">
<p><strong>Your reference is optional.</strong></p>
<p>Enter a code of your choice for reference purposes.</p>
</div>
</div>