gpt4 book ai didi

javascript - 移动按钮不起作用( Bootstrap )

转载 作者:行者123 更新时间:2023-12-03 03:57:12 26 4
gpt4 key购买 nike

我正在使用 jQuery 和 Bootstrap。正如下面的 html 中提到的,移动按钮不会展开。我已经在这个网站上检查过有关确认数据目标的信息,但没有运气。这是我的代码,

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<title>name</title>
<meta name="description" content="name">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width,initial-scale=1" name="viewport">

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<link rel="stylesheet" href="css/main.css">
</head>

<body>

<!-- Navbar -->
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header"> <!-- 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"> name </a>
</div> <!-- End Navbar Header -->

<div class="collapse navbar-collapse navbar-right" id="navbar">
<ul class="nav navbar-nav">
<li><a href="lastName_OnlineSummary.pdf">PDF</a></li>
<li><a href="https://www.linkedin.com/in/username/">LinkedIn</a></li>
<li><a href="https://github.com/username">GitHub</a></li>
<li><a href="mailto:username@users.github.com">Contact</a></li>
</ul>
</div> <!-- End Navbar-collapse -->
</div> <!-- End Container -->
</nav> <!-- End Navbar -->

<!-- ... -->

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<script type='text/javascript' src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

</body>
</html>

最佳答案

您必须在 jQuery 之后加载 Bootstrap 脚本。这是因为 Bootstrap 依赖于 jQuery,并且必须首先加载该脚本,因此 Bootstrap 的脚本可以使用它。 像这样:

<script type='text/javascript' src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

关于javascript - 移动按钮不起作用( Bootstrap ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44891878/

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