Bootstrap中的弹出框插件popover.js中的参数title、content不能使用html代码

来源:互联网 发布:mac 批量保存网页图片 编辑:程序博客网 时间:2024/04/25 20:57
加入自定义代码
<script>    
$(".pop").each(function() {
  var $pElem = $(this);
  $pElem.popover({
    html: true,
    trigger: "manual",
    title: getPopoverTitle($pElem.attr("id")),
    content: getPopoverContent($pElem.attr("id")),
    container: 'body',
    animation: false
  });
}).on("mouseenter",


function() {
  var _this = this;
  $(this).popover("show");
  console.log("mouse entered");
  $(".popover").on("mouseleave",
  function() {
    $(_this).popover('hide');
  });
}).on("mouseleave",


function() {
  var _this = this;
  setTimeout(function() {
    if (!$(".popover:hover").length) {
      $(_this).popover("hide");
    }
  },
  100);
});


function getPopoverTitle(target) {
  return $("#" + target + "_content > h2.popover-title").html();
};


function getPopoverContent(target) {
  return $("#" + target + "_content > div.popover-content").html();
};
 $('[data-toggle="popover"]').popover();   //因为考虑到性能,默认吧该功能给禁了,使用这句打开
</script>


0 0
原创粉丝点击