I have trying to position my popover based on the left and right position of a div but I am not able to do that.
The bottom image shows the problem I am facing
The code I have for the popover is as follows:
$('a[rel=popover]').popover({
html: true,
trigger: 'hover',
trigger: 'click',
placement: 'right',
template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title" style="display:none;"></h3><div class="popover-content"><p></p></div></div></div>',
content: function () { return '<img style="width:250px" src="' + $(this).data('img') + '" />'; }
});
I tried using the placement as a function as suggested in the following links:
Is it possible to change the position of Bootstrap popovers based on screen width?
These didn't work.
IMPORTANT The image shown to you is in a fancybox