[英]Bootstrap dropdown disappears too quickly
I am using a Bootstrap dropdown menu. 我正在使用Bootstrap下拉菜单。 It all worked fine untill i made some changes I can't undo anymore.
一切正常,直到我做了一些我无法撤消的更改。 When I go to my website on a mobile phone the dropdown disappaers after 1-2 seconds.
当我通过手机访问网站时,下拉菜单会在1-2秒后消失。 If I use the original bootstrap it works fine but when I use my own it doesn't.
如果我使用原始的引导程序,则可以正常工作,但是当我使用自己的引导程序时,则不能。 I searched everywhere for the answer but I haven't found a solution.
我在各处搜索了答案,但没有找到解决方案。 I also made a JS Fiddle to show you.
我还制作了一个JS小提琴来向您展示。
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#inverseNavbar1">
<span class="sr-only"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="">Home</a>
</div>
<div class="collapse navbar-collapse" id="inverseNavbar1">
<ul class="nav navbar-nav">
<li class="active"><a href="info">Info<span class="sr-only"></span></a>
</li>
<li class="active"><a href="foto">Foto's<span class="sr-only"></span></a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="beschikbaarheid">Beschikbaarheid</a>
</li>
<li><a href="prijzen">Prijzen</a>
</li>
<li><a href="contact">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
Thanks in advance 提前致谢
I suspect that at least one rule is missing from the bootstrap.css. 我怀疑bootstrap.css中至少缺少一条规则。 If you add:
如果添加:
.collapse.in {
display: block;
}
You get the functionallity back but the animation does not look good. 您恢复了功能,但动画效果不佳。
In bootstrap the navbar when collapsed will have classes 在引导中,导航栏在折叠时将具有类
<div class="navbar-collapse collapse"></div>
During animation it will get: 在动画期间它将得到:
<div class="navbar-collapse collapsing" aria-expanded="true" style="height:SOMEHEIGHT"></div>
And after, when visible 之后,当可见时
<div class="navbar-collapse collaps in" aria-expanded="true"></div>
Without the css rule, when the animation of the menu is finished the menu was not shown because there exist a rule that hides all items with class collapse: 如果没有css规则,则当菜单的动画完成时,菜单不会显示,因为存在一个规则,该规则会隐藏所有具有类折叠的项:
.collapse {
display: none
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.