html 元素中增加屬性 data-toggle及data-content
<label data-toggle="popover" data-content="111">測試</label>
js中增加
$(function () {
$("[data-toggle='popover']").popover({
trigger:'manual',
placement : 'top',//彈出位置
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")
}
}, 100);
});
});
參考鏈接:https://www.jb51.net/article/87218.htm
