【发布时间】:2012-05-07 14:01:58
【问题描述】:
我正在使用 Twitter Bootstrap,但在 iPad 和 iPhone 上进行测试时遇到了一些我无法修复的问题。在移动设备(至少是那些设备)上,您需要单击以启用提示或弹出窗口(如预期的那样)。问题是一旦你关闭它就永远无法关闭。如果您再次单击它,我添加了一个侦听器以将其关闭,但我很难相信默认行为不会是单击以将其删除。这是 Bootstrap 弹出框和工具提示中的错误吗?我的代码在下面 - 它似乎可以工作,但只有当您单击创建提示或弹出框的同一项目时 - 页面上的任何位置都没有(无法使其工作)。
触发代码:
$(function () {
//Remove the title bar (adjust the template)
$(".Example").popover({
offset: 10,
animate: false,
html: true,
placement: 'top',
template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><div class="popover-content"><p></p></div></div></div>'
//<h3 class="popover-title"></h3>
//Need to have this click check since the tooltip will not close on mobile
}).click(function(e) {
jQuery(document).one("click", function() {
$('.Example').popover('hide')
});
});
});
HTML:
<a href="javascript:void(0);" class="Example" rel="popover" data-content="This is the Data Content" data-original-title="This is the title (hidden in this example)">
提前致谢!
丹尼斯
【问题讨论】:
-
这里有同样的问题,第一次点击它会阻止点击去按钮。所以我必须单击两次才能使按钮正常工作。
-
我在 GitHub 上也发布了这个错误 - 还没有回复。我想知道推特是否知道这件事?他们必须!也许还没有太多人在手机上玩这个……? github.com/twitter/bootstrap/issues/3417
-
你做得很好,我不知道该怎么做,除了根本不使用弹出框和工具提示 :(。我希望我们至少可以为触摸设备禁用它们。
标签: mobile tooltip twitter-bootstrap popover