淡出推特引导popover上的不同元素

Fading out twitter bootstrap popover on different element

本文关键字:元素 popover 淡出      更新时间:2023-09-26

我使用popover()函数来进行popover。我是这样使用的:

$(status).popover({
      trigger: 'click',
      placement: 'top',
      html: true,
      title: "<div style='color:black'>Details:</div>",
      content: $(statuses).html()})

它就像我希望的那样工作。除了一件事,现在当用户点击特定的元素时,他会被弹出,他需要再次点击该元素才能将其清除,事实就是这样。是否可以在单击页面上的任意位置后使其消失?

要执行此操作,需要将trigger属性设置为focus:

$(status).popover({
    trigger: 'focus',
    placement: 'top',
    html: true,
    title: "<div style='color:black'>Details:</div>",
    content: $(statuses).html()
});

这意味着只有当status元素在浏览器中具有焦点时,popover才处于活动状态,单击窗口中的其他任何位置都将取消popover。