bootstrap 弹出框实现点击后打开离开后关闭
$("#PersonName").popover({ trigger: 'manual', placement: 'bottom', //title: '<div style="text-align:center; color:red; text-decoration:underline; font-size:14px;"> Muah ha ha</div>', html: 'true', content: '<div id="popOverBox" style="color:#000;">' + htmlStr + '</div>', template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content">sdfsdfds</div></div>', 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); });
<span id="PersonName" rel="drevil" style="margin-left: 5px; line-height: 35px; font-size: 13px; color: white;" ></span>