I'm currently experimenting with using popover in Bootstrap 4. I have set the toggle button to appear on the top right corner.
Initially, when I set the popover placement to 'bottom' like this:
$(function () {
$('[data-toggle="popover"]').popover({
placement: 'bottom'
})
The popover ends up being displayed partially off the screen as shown here:
https://i.sstatic.net/ZY7PZ.jpg
Next, I attempted using 'auto' instead of 'bottom' for placement, but unfortunately, the popover did not work...
Afterwards, I reverted back to using 'bottom' for placement and adjusted the offset to move the popover 50px to the left while increasing its width:
$('[data-toggle="popover"]').popover({
placement: 'bottom',
offset: '0 50px'
})
CSS:
.popover-content{
width: 270px;
}
As a result, the popover now appears like this:
https://i.sstatic.net/MzamR.jpg
However, the position of the popover-arrow is incorrect. I tried adjusting the arrow position using the 'shown.bs.popover' event like this:
$('[data-toggle="popover"]').on('shown.bs.popover', function () {
$('.popover.bottom .popover-arrow:after').css('right', 50 + 'px');
});
Unfortunately, this adjustment did not have any effect....
Does anyone have a solution for repositioning the arrow or hiding it when it appears?
Thank you in advance.