Javascript Bootstrap Popover单击关闭:在桌面浏览器中工作正常,但在移动浏览器中不工作
因此,我有一个在NodeJ上运行的web应用程序,它的前端使用引导。我集成了一些引导弹出窗口,它们执行以下操作:Javascript Bootstrap Popover单击关闭:在桌面浏览器中工作正常,但在移动浏览器中不工作,javascript,ios,twitter-bootstrap,popover,Javascript,Ios,Twitter Bootstrap,Popover,因此,我有一个在NodeJ上运行的web应用程序,它的前端使用引导。我集成了一些引导弹出窗口,它们执行以下操作: 当用户单击或轻触图像时,它将弹出弹出窗口 用户可以单击任意位置,它将关闭popover 当我从台式机或笔记本电脑浏览器打开应用程序时,它们工作正常,但当我在移动浏览器(iPhone上的safari)上打开应用程序(使用计算机的IP地址)时,弹出窗口不会在单击时关闭。这里有什么问题?我遗漏了什么吗?代码如下: <img src='/images/question.png' tab
<img src='/images/question.png' tabindex="0" role="button" data-trigger="focus" height="10" width="10" data-toggle="popover" title="Daily Hub Activity" data-content="Lorem ipsum blablabla." animation="true" data-placement="bottom">
我相信iOS不会将点击事件绑定到
html
或body
。尝试一下类似的方法():
希望这能有所帮助。嘿,它不起作用,但还是感谢您的参考!更近一步。这里有类似的问题:
$('[data-toggle="popover"]').popover();
$('body').on('click', function (e) {
$('[data-toggle="popover"]').each(function () {
//the 'is' for buttons that trigger popups
//the 'has' for icons within a button that triggers a popup
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});