我正在使用 Twitter Bootstrap 2.3.2,并且我正在注册一个弹出窗口,每当带有选择器的 td 悬停在上面时就会打开。但是我注意到在控制台中内容回调被触发两次。有没有办法防止这种情况发生?
$('#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>
您的代码是正确的,这个问题来自引导程序本身,他们说这是故意行为而不是错误。有关更多详细信息,请参阅此 github 问题https://github.com/twbs/bootstrap/issues/12563 https://github.com/twbs/bootstrap/issues/12563
仅供参考,他们没有在 Bootstrap 3.2(这是当前的稳定版本)中更改此行为,但我认为他们计划在下一个版本(3.2.1)中更改此行为
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)