Bootstrap委托Pop over内容回调触发两次 [英] Bootstrap delegated pop over content callback triggered twice

查看:285
本文介绍了Bootstrap委托Pop over内容回调触发两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Twitter Bootstrap 2.3.2,我正在注册一个popover,只要有一个选择器的td悬停在一起。但是我在控制台内注意到内容回调正在被触发两次。有没有办法防止这种情况发生?

I'm using Twitter Bootstrap 2.3.2 and I'm registering a popover to open whenever a td with a selector is hovered over. However I have noticed within the console that the content callback is being trigger twice. Is there a way to prevent this from happening?

$('#table-data').popover({
    selector: '.td-popover',
    trigger : 'hover',
    content : function () {
        console.log(this, arguments)
        return 'hello';
    }
});

<table id="table-data">
    <tbody>
        <tr>
            <td></td>
            <td class="td-popover"></td>
            <td></td>
            <td class="td-popover"></td>
        </tr>
    </tbody>
</table>


推荐答案

你的代码是正确的,这个问题来自bootstrap本身他们说这是一个有意的行为,而不是一个bug。有关详细信息,请参阅此github问题 https://github.com/twbs/bootstrap/issues/12563

your code is correct, this issue comes from bootstrap itself, they say that it is an intentional behavior and not a bug. see this github issue for more details https://github.com/twbs/bootstrap/issues/12563

它们在Bootstrap 3.2(这是当前的稳定版本)中没有改变这种行为,但我认为他们计划在下一个一(3.2.1)

FYI they didn't change this behavior in Bootstrap 3.2 (which is the current stable release), but I think that they plan to do it in the next one (3.2.1)

这篇关于Bootstrap委托Pop over内容回调触发两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆