我在我的网站上添加了一个下拉菜单,但是当导航栏折叠时,它在移动设备上无法正常工作。当我点击下拉列表时,它会关闭导航栏,而不是显示下拉列表中的项目。
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#page-top">Name</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="hidden">
<a href="#page-top"></a>
</li>
<li class="page-scroll">
<a href="#portfolio">Portfolio</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Games <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="/Spikes" target="_blank">Avoid The Spikes</a></li>
<li><a href="/SpaceShooter" target="_blank">Space Shooter</a></li>
<!--<li role="separator" class="divider"></li>-->
<!--<li class="dropdown-header">Nav header</li>-->
<!--<li><a href="#">Separated link</a></li>-->
</ul>
</li>
我认为它与ID <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">