I am trying to use popover in bootstrap 4. The switch button that I set in the upper right corner.
first, if I set the popover to the button:
$(function () {
$('[data-toggle="popover"]').popover({
placement: 'bottom'
})
a popup will be displayed with a part off the screen, like:

then I try to use 'auto' instead of 'bottom' in the placement, but in this case the popup does not work ...
after that I use 'bottom' again in the layout and use offset to move the popover 50px to the left and increase the width of the popover:
$('[data-toggle="popover"]').popover({
placement: 'bottom',
offset: '0 50px'
})
CSS:
.popover-content{
width: 270px;
}
then popover show like this:

now the position of the arrow of the popover is not in place, I'm trying to move the position of the arrow with the help of the event '' selected.bs.popover ', for example:
$('[data-toggle="popover"]').on('shown.bs.popover', function () {
$('.popover.bottom .popover-arrow:after').css('right', 50 + 'px');
});
but it does not work ....
- , , ?
.