我使用Bootstrap折叠和扩展div中的链接列表构建了一个自定义菜单。大多数链接都是页面内的锚点。单击链接时,菜单将关闭。一切都在桌面上完美运行,但在移动设备上菜单不会关闭。
我把头发拉出来...据我所知,Safari手机确实认为链接是互动的,但div不是......所以我的问题可能是菜单在div内?或者也许这是我的js ......有什么想法吗?
<div class="collapse" id="expandmenu">
<div class="well">
<div class="container">
<button type="button" class="navbar-toggle2 pull-right" data-toggle="collapse" href="#expandmenu" aria-expanded="false" aria-controls="collapseExample" style="float:right; padding:16px 5px 17px 0px; color:#333;"><p class="explore" style="font-size:0.8em; color:#333;">Close </p>
<span class="glyphicon glyphicon-remove" aria-hidden="true" style="font-size:1.1em;"></span>
</button>
<div class="row">
<div class="col-sm-12 hidden-xs" style="text-align:center; margin-top:0px; color:#333;">
</div>
</div>
<div class="row">
<ul class="txt-ctr" style="padding-left:0px;">
<a href="#passwordstationbenefits"><li class="menubutton"><span>Benefits</span></li></a>
<a href="#overview"><li class="menubutton">Overview</li></a>
<a href="#design"><li class="menubutton"><span>Features</span></li></a>
<a href="#reporting"><li class="menubutton"><span>Reports</span></li></a>
<a href="#security"><li class="menubutton"><span>Security</span></li></a>
<a href="#helpdesk"><li class="menubutton"><span>Help Desk</span></li></a>
<a href="#appsupport"><li class="menubutton"><span>Apps</span></li></a>
<a href="#architecture"><li class="menubutton"><span>Architecture</span></li></a>
<a href="#languages"><li class="menubutton"><span>Languages</span></li></a>
<a href="#ticketing"><li class="menubutton"><span>Ticketing</span></li></a>
<a href="#testimonials"><li class="menubutton"><span>Testimonials</span></li></a>
<a href="/products/identity-management/password-management/password-station/demo/"><li class="menubutton"><span>Demo</span></li></a>
<a href="#resources"><li class="menubutton"><span>Resources</span></li></a>
<a href="#payingtwice"><li class="menubutton"><span>True Cost</span></li></a>
<a href="/pricing"><li class="menubutton"><span>Get Pricing</span></li></a>
</ul>
</div>
</div>
</div>
</div>
和我的js:
$('#expandmenu a').click(function(){
$("#expandmenu button").click();
});