gpt4 book ai didi

html - 移动 Bootstrap 导航栏按钮不折叠

转载 作者:行者123 更新时间:2023-11-28 03:09:11 25 4
gpt4 key购买 nike

我知道这已经发布了很多次,但我仍然找不到解决方案。我尝试在移动设备上查看它并缩小浏览器,但所有导航折叠按钮都没有“折叠”。我遵循了其他帖子提供的指导,但没有一个奏效。我已将 data-target 设置为正确的 ID,并且已获取所有脚本。

我的代码:

nav ul li{
width:117px;
}
nav{
box-shadow: 15px 0px 45px #1f2021;
}
.navbar-fixed-top{
position:absolute!important;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1,
minimum-scale=1, maximum-scale=1" />

<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Title</title>

<!-- Bootstrap -->
<link href="css/blog.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/starter-template.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" media="only screen and (min-width:1261px)" href="css/custom.css">
<link rel="stylesheet" media="only screen and (min-width:781px) and
(max-width:1260px)" href="css/tablet.css">
<link rel="stylesheet" media="only screen and (max-width:780px)" href="css/mobile.css">
<script src="jquery-3.2.1.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js">
</script>
<script>
window.jQuery || document.write('<script
src = "../../assets/js/vendor/jquery.min.js" > < \/script>')
</script>
<script src="../../dist/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
<link rel="manifest" href="manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
</head>
<body>
<div id="main-content">
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="logoSpace">
<center> <img id="logo" src="img/logo.png"><br /></center>
</div>
<div class="container">
<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>
</div>

<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Home <span class="glyphicon glyphicon-home"
aria-hidden="true"></span></a></li>
<li><a href="about.html">About <span class="glyphicon
glyphicon-plus" aria-hidden="true"></span></a></li>
<li class="active"><a href="roster.html">Roster <span
class="glyphicon glyphicon-user"></span></a></li>
<li><a href="history.html">History <span class="glyphicon
glyphicon-list-alt"></span></a></li>
<li style="width:130px;float:left;"><a href="schedule.html">Schedule <span class="glyphicon glyphicon-list">
</span></a></li>
<li><a href="photos.html">Photos <span class="glyphicon
glyphicon-camera" aria-hidden="true"></span></a></li>
<li><a href="videos.html">Videos <span class="glyphicon
glyphicon-film"></span></a></li>
<li><a href="coaches.html">Coaches <span class="glyphicon
glyphicon-book"></span></a></li>
<li><a href="contact.html">Contact <span class="glyphicon
glyphicon-send"></a></li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</nav>
</body>
</html>

最佳答案

您有一些错位的标签。喜欢失踪</div></span> .这个有效。

div#navbar.navbar-collapse.collapse.in {
max-height:600px
}
nav{
box-shadow: 15px 0px 45px #1f2021;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<!-- Fixed navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<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><a href="index.html">Home <span class="glyphicon glyphicon-home"
aria-hidden="true"></span></a></li>
<li><a href="about.html">About <span class="glyphicon
glyphicon-plus" aria-hidden="true"></span></a></li>
<li class="active"><a href="roster.html">Roster <span
class="glyphicon glyphicon-user"></span></a></li>
<li><a href="history.html">History <span class="glyphicon
glyphicon-list-alt"></span></a></li>
<li><a href="schedule.html">Schedule <span class="glyphicon glyphicon-list">
</span></a></li>
<li><a href="photos.html">Photos <span class="glyphicon
glyphicon-camera" aria-hidden="true"></span></a></li>
<li><a href="videos.html">Videos <span class="glyphicon
glyphicon-film"></span></a></li>
<li><a href="coaches.html">Coaches <span class="glyphicon
glyphicon-book"></span></a></li>
<li><a href="contact.html">Contact <span class="glyphicon
glyphicon-send"></span></a></li>
</ul>

</div>
<!--/.nav-collapse -->
</div>
</nav>

<div class="container">

<div class="jumbotron">
<h1>Navbar example</h1>
<p>This example is a quick exercise to illustrate how the fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
</div>
</div>

<!-- /container -->

关于html - 移动 Bootstrap 导航栏按钮不折叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45804110/

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