Bootstrap Popover Dismissable is not working

大城市里の小女人 提交于 2019-12-24 08:47:43

问题


<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&reg; 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>

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.


回答1:


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();

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();


来源:https://stackoverflow.com/questions/26694669/bootstrap-popover-dismissable-is-not-working

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