Bootstrap Popover Dismissable无法正常工作 [英] Bootstrap Popover Dismissable is not working
问题描述
<a href="#" class="btn btn-warning" id="no_mls_entry" tabindex="2" data-toggle="popover" data-trigger="focus" data-placement="left auto" title="Early Bird Gets The Worm" data-content="Sometimes it takes some time for the MLS® RETS pool to update your new listing. Loading it manually early, then sharing on social media will give you better exposure on Google.">Enter Without MLS #</a>
以上是我的弹出式HTML语法,根据他们的说明设置为data-trigger ="focus",以使其在点击时关闭.
The above is my popover HTML syntax, set to data-trigger="focus" according to their instructions to make it dismiss on click.
然后在准备好文档后,运行以下命令:
And then on document ready, I run this:
$('#no_mls_entry').popover('show');
弹出窗口很好显示,但是单击它并不会消失.
The popover shows up alright, but on clicking it, it does not go away.
推荐答案
管理焦点的方式似乎存在问题.
It appears to be an issue with the way focus is being managed.
您可以尝试以下方法来增强焦点:
You could try the following to force the focus:
$('#no_mls_entry').popover('show').focus();
这是bootply中的代码示例:
Here is an example of the code in bootply:
http://www.bootply.com/J1iTFk9M1Y
或者,如果您不希望在页面加载时显示弹出窗口,则可以使用以下代码加载弹出窗口,并在按下按钮时触发该弹出窗口:
Alternatively, if you are willing to not show the popover on page load, you can load the popover with the following code and it will be triggered on pressing the button:
$('#no_mls_entry').popover();
这篇关于Bootstrap Popover Dismissable无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!