gpt4 book ai didi

javascript - Bootstrap 导航 - 手机

转载 作者:太空宇宙 更新时间:2023-11-03 17:37:40 25 4
gpt4 key购买 nike

如您所见,内容在移动设备上和页面重新缩放时不在 = 框内

enter image description here

我当前的 HTML

<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" 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" title="Index" href="http://www.example.com">MP3Jungle</a>
<a class="navbar-brand" title="Singles" href="http://www.example.com/category/singles/">Singles</a>
<a class="navbar-brand" title="Singles" href="http://www.example.com/category/videos/">Videos</a>
<a class="navbar-brand" title="Singles" href="http://www.example.com/category/albums/">Albums</a>
<a class="navbar-brand" title="Singles" href="http://www.example.com/category/mixtapes/">Mixtapes</a>
</div>
<form class="navbar-form navbar-right" action="/" method="post" accept-charset="utf-8" role="search">
<div class="form-group">
<input type="text" name="s" id="s" class="form-control" placeholder="Search..."/>
</div>
</form>
</div>
</nav>

如何将内容放入折叠框中?谢谢!

最佳答案

Bootstrap 期望菜单链接是 <ul>您在折叠按钮的数据目标中指定的。然后它将获取该 UL 并将其放置在移动版本的按钮“下方”。此外,请确保您正在为 Bootstrap 同时加载 css 和 js。

与这个工作示例比较:

Fiddle

<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<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="#">Project name</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="./">Default <span class="sr-only">(current)</span></a></li>
<li><a href="../navbar-static-top/">Static top</a></li>
<li><a href="../navbar-fixed-top/">Fixed top</a></li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</nav>

关于javascript - Bootstrap 导航 - 手机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29566358/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com