I am using a Bootstrap Popover in a \'Repeat Region\' which displays Testimonials. Each testimonials has a \'View Property Details\' button which opens up the popover. In th
my solution is based upon the previous solutions here, with a bit more. i needed (as usually), all the complexity: here's how you can create the popover content on demand when the event triggers, and have the selected element passed to the creating function.
function displayProductPrice(a, tag) {
var div = a.closest('div');
var secs = ['aggregated', 'compare', 'list', 'saved', 'details'];
var title = '';
for (var c in secs) {
var obj = $('.product-price-' + secs[c], div);
if (obj.length) {
if (title) {
title += '
';
}
title += obj.html();
}
}
return '<' + tag + '>' + title + '' + tag + '>';
}
$( document ).ready(function() {
$(".product-price-expand").popover({
content: function() {return displayProductPrice(this, 'h6')},
title: function() {
return $('.product-id', this.closest('div')).html();
},
html: true,
trigger: 'click focus',
placement: 'auto'
});
});
enjoy, hope this helps.