【问题标题】:Fading out twitter bootstrap popover on different element在不同元素上淡出 twitter bootstrap popover
【发布时间】:2015-02-10 10:30:50
【问题描述】:

我正在使用 popover() 函数来制作弹出框。我是这样使用它的:

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

它就像我想要的那样工作。除了一件事,现在当用户单击特定元素时,他会弹出,他需要再次单击该元素才能摆脱它,实际上是这样。在页面点击ANYWHERE后是否可以让它消失?

【问题讨论】:

    标签: javascript jquery twitter-bootstrap popover


    【解决方案1】:

    为此,您需要将trigger 属性设置为focus

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

    这意味着弹出框仅在 status 元素在浏览器中具有焦点时才处于活动状态,单击窗口中的其他任何位置都会关闭弹出框。

    【讨论】:

    • 根本不显示弹出窗口,也许我有旧版本的引导程序。悬停并点击工作
    • 这可能是问题所在。它绝对适用于最新的引导程序版本。在此处查看“可解雇”演示:getbootstrap.com/javascript/#popovers
    猜你喜欢
    • 1970-01-01
    • 2013-11-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    • 1970-01-01
    • 2013-03-16
    • 1970-01-01
    • 2012-05-07
    相关资源
    最近更新 更多