2017-07-17 283 views
0

如果我没有将data-trigger =“focus”作为其定义的一部分,那么在图标上定义的Bootstrap弹出窗口可以正常工作。当我包含它时,弹出窗口不会在我点击图标时显示。这是没有数据触发器的代码。Bootstrap data-trigger =“focus”不起作用

<a data-toggle="popover" data-placement="left" data-title="Membership history for Fred Smith" data-html="true" data-content="<table><thead><tr><th class='col-md-2 text-left'>Renewed</th><th>Expiration</th><th>Type</th></tr></thead><tbody><tr><td>12/09/2016</td><td>12/31/2017</td><td>1-Year Individual</td></tr></tbody></table>"><span class="glyphicon glyphicon-info-sign" style="color:grey;"></span></a> 

而且包括数据触发代码:

<a data-toggle="popover" data-placement="left" data-trigger="focus" data-title="Membership history for Fred Smith" data-html="true" data-content="<table><thead><tr><th class='col-md-2 text-left'>Renewed</th><th>Expiration</th><th>Type</th></tr></thead><tbody><tr><td>12/09/2016</td><td>12/31/2017</td><td>1-Year Individual</td></tr></tbody></table>"><span class="glyphicon glyphicon-info-sign" style="color:grey;"></span></a> 

我还要提到的是,图标是一个表格单元格中。

任何想法?

+0

根据我的问题,弹出式工程不需要数据触发器,也不能用数据触发器打开。另外,根据我包含的代码,这不是一个按钮。 – Pete

回答

4

要在引导弹窗上使用data-trigger="focus"属性,您需要使用tabindex="0"。 这样的 - (编辑改的tabindex到TABINDEX)

<a tabindex="0" data-toggle="popover" data-placement="left" data-trigger="focus" data-title="Membership history for Fred Smith" data-html="true" data-content="<table><thead><tr><th class='col-md-2 text-left'>Renewed</th><th>Expiration</th><th>Type</th></tr></thead><tbody><tr><td>12/09/2016</td><td>12/31/2017</td><td>1-Year Individual</td></tr></tbody></table>"><span class="glyphicon glyphicon-info-sign" style="color:grey;"></span></a> 

希望这有助于!

+0

我还没有见过记录在任何地方,但我试过了,popover仍然没有打开 – Pete

+1

我找到了关于此的文档,谢谢。我现在正在工作,它应该是tabindex,而不是tab-index。编辑您的示例代码以显示并将其标记为正确的答案。后续 - 看起来我的编辑显示更正必须经过同行评审,以便最终可能显示或不显示。 – Pete

+0

很高兴它可以帮助并感谢编辑。 – neophyte