如何在动态内容插入后重新定位 Bootstrap Popover?
- 论坛
- 如何在动态内容插入后重新定位 Bootstrap Popover?
10 浏览
如何在动态内容插入后重新定位 Bootstrap Popover?
当我用一个空的content选项加载Bootstrap Popover,并动态插入内容时,Popover会失去正确的位置。
例如:
$('td.chartSection').each(function () {
var $thisElem = $(this);
$thisElem.popover({
placement: 'top',
trigger: 'hover',
html: true,
container: $thisElem,
delay: {
hide: 500
},
content: ' '
});
});
//弹出窗口显示后,运行此事件
$('td.chartSection').on('shown.bs.popover', function () {
var $largeChart = $(this).find('.popover .popover-content');
//插入一些虚拟内容
$largeChart.html("dfjhgqrgf regqef f wrgb wrbgqwtgtrg
wfghjqerghqreg fbvwqbtwfbvfgb
efgwetrg");
});
我的问题是:
是否有一种方法可以重新计算Popover的位置,如$('td.chartSection').popover('recalculate')。
或者是否有其他方法可以重新定位Popover,而不是手动用CSS样式来实现?