Struggling with the bootstrap popover here. I can't seem to change the popover position from top to bottom when it reaches the top of the viewport. I attempted to use
placement: 'auto bottom' but unfortunately, it didn't do the trick for me.
$(function(){
var options = {
placement: function (context, element) {
var position = $(element).position();
console.log(position.top - $(window).scrollTop());
if (position.top - $(window).scrollTop() < 110){
return "bottom";
}
return "top";
}, html: true
};
$(".popover-link").popover(options);
});
Update:
I managed to get the "popover" to display on the top as intended. However, the popover at the bottom ends up with a negative position and consistently shows at the bottom.