twitter-bootstrap Bootstrap 弹出窗口在表格中不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17857885/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bootstrap popovers not working in table
提问by Skytiger
I've included the following in my html file:
我在我的 html 文件中包含了以下内容:
<h:outputStylesheet name="css/bootstrap.css" />
<h:outputScript name="js/jquery-2.0.2.min.js" />
<h:outputScript name="js/bootstrap-tooltip.js" />
<h:outputScript name="js/bootstrap-popover.js" />
The part that is supposed to make the popover:
应该制作弹出框的部分:
<ui:repeat var="lowFareCalenderSearchItem" value="#{lowFareCalenderSearchItems}">
<td>
<a href="#" id="searchItem" class="btn" rel="popover">#searchResult.getTotal()}</a>
<script>
$("#searchItem").popover({
title: "title",
content: "content"
});
</script>
</td>
</ui:repeat>
The popovers I'm trying to get to display don't turn up when I hover over or click the button.
当我悬停或单击按钮时,我试图显示的弹出窗口没有出现。
I have looked at other similar questions, and nothing I've found there has worked for me.
我查看了其他类似的问题,但没有发现对我有用。
Does anyone know why this could be happening?
有谁知道为什么会发生这种情况?
回答by Skytiger
It turns out that the popover can't just be put into the table cell.
事实证明,popover 不能只是放入表格单元格中。
I solved it by using a div and span inside the cell:
我通过在单元格内使用 div 和 span 来解决它:
<td>
<div>
<span id="searchItem" rel="popover">
Click to pop
</span>
<script>
$(document).ready(function() {
$("#searchItem").popover({
html: true,
animation: false,
content: "TO BE ANNOUNCED",
placement: "bottom"
});
});
</script>
</div>
</td>

