html代碼
<button type="button" rel="drevil" data-content="報名截止時間:'+time+'" data-container="body" data-toggle="popover" data-placement="bottom"></button>
JS代碼
$(function () { $("[data-toggle='popover']").popover(); });
$("[rel=drevil]").popover({
trigger:'manual',
html: 'true', //needed to show html of course
animation: false
}).on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(this).siblings(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide")
}
}, 300);
});
來自原文地址