gpt4 book ai didi

javascript - 切换菜单立即消失

转载 作者:行者123 更新时间:2023-11-28 16:18:27 27 4
gpt4 key购买 nike

通过单击切换按钮,我只能看到菜单(我已在切换按钮上设置)四分之一秒,然后消失。我是 Bootstrap 的新手。我可能犯了一些非常明显的错误。感谢您的帮助。

<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<title></title>
</head>
<body>
<div class="container ">
<nav class="navbar navbar-expand-sm navbar-dark bg-dark">
<a href="#" class="navbar-brand"><img src="logo.png">The building co.</a>
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#myMenu">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="myMenu">
<ul class="navbar-nav">
<li class="nav-item" > <a href="#" class="navbar-link">Home </a> </li>
<li class="nav-item" > <a href="#" class="navbar-link">contact us </a> </li>
<li class="nav-item" > <a href="#" class="navbar-link">policy </a> </li>
<li class="nav-item" > <a href="#" class="navbar-link">terms </a> </li>
<li class="nav-item" > <a href="#" class="navbar-link">About us </a> </li>
</ul>
</div>
</nav>
</div>
</body>
</html>

最佳答案

首先,根据 bootstrap documentation,您拥有准确的入门模板.

<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<title>Hello, world!</title>
</head>
<body>
<h1>Hello, world!</h1>

<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>

之后根据引导documentation sample放置引导导航栏组件链接.

关于javascript - 切换菜单立即消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55297014/

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