Twitter Bootstrap subnav关闭,而不是激活iPhone上的链接 [英] Twitter Bootstrap subnav closes instead of activating link on iPhone
问题描述
我的网站上有以下导航
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar pull-right" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="/"><span class="icon-chevron-up icon-medium"></span> Rocky Mountain Arts</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Gallery <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/Gallery" class="pjax">For Sale</a></li>
<li><a href="/Gallery/Sold" class="pjax">Sold</a></li>
<li><a href="/Gallery/PrivateCollection" class="pjax">Private Collection</a></li>
</ul>
</li>
<li><a href="/About" class="pjax">About The Artist</a></li>
<li><a href="/Contact" class="pjax">Contact</a></li>
</ul>
</div>
</div>
</div>
</div>
当我在桌面上查看该网站时,可以看到所有预期的内容,并且可以浏览所有链接.
When I view the site on my desktop, I see everything as expected, and I can navigate all of the links.
但是:当我在iPhone上加载网站时,按toggle collapse
按钮,然后展开dropdown
,我无法单击下拉菜单中的任何子链接,而是菜单关闭,并且关于"或联系"链接会被激活.
HOWEVER: When I load the site up on my iPhone, press the toggle collapse
button and then expand the dropdown
, I cannot click any of the sub links within the dropdown menu, rather the menu closes and either the "about" or the "contact" link activate instead.
我该如何解决?
推荐答案
感谢@MiikaL的评论.看起来这是Github提交的一个错误,在官方源代码中没有人真正解决过.
Thanks @MiikaL for the comment. Looks like it's a bug filed over at Github that no-one is really addressing in the official source code.
https://github.com/twitter/bootstrap/issues/4550
这可以在github组件演示页面上重现
http://twitter.github.com/bootstrap/components.html#buttonDropdowns
This can be reproduced on the github components demo page
http://twitter.github.com/bootstrap/components.html#buttonDropdowns
有些人掌握着有用的信息,而黑客"解决方案似乎是
There are people with helpful info in the tread, and the 'hack' solution seems to be
// Fixes sub-nav not working as expected on IOS
$('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });
这篇关于Twitter Bootstrap subnav关闭,而不是激活iPhone上的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!