Bootstrap delegated pop over content callback triggered twice

巧了我就是萌 提交于 2019-12-23 21:42:20

问题


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>

回答1:


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

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)



来源:https://stackoverflow.com/questions/24450533/bootstrap-delegated-pop-over-content-callback-triggered-twice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!