I have a problem with bootstrap popover, i can't figure how to change popover position from top to bottom when it reaches top of the viewport. I tried to use
placement: 'auto bottom' but this doesn't work 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
this worked for me, for "popover" in top, but popover at the bottom gets negative position, and it's always shows at the bottom