Bootstrap下拉列表无法正确下降
当我尝试使用Bootstrap的下拉菜单时,似乎并没有下降。 我从网站复制了确切的代码,以确保我不会缺少任何东西。
我只有1个文件,一个带有此代码的HTML文件:
<!DOCTYPE html>
<html>
<head>
<title>Web Dev Test</title>
<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" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<header>
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown button
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
</header>
</body>
</html>
我不明白怎么了。我以前做过下拉菜。为什么我不能在一个基本的空白项目上进行操作?我已经搜寻了互联网,并尝试了许多不同的修复程序,但无济于事。
When I try using a dropdown menu from bootstrap, it doesn't seem to be dropping down.
I copied the exact code from the site to make sure I wasn't missing something.
I only have 1 file, an HTML file with this code:
<!DOCTYPE html>
<html>
<head>
<title>Web Dev Test</title>
<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" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<header>
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown button
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
</header>
</body>
</html>
I don't understand what's wrong; I've done dropdowns before. Why can't I do it on a basic blank project? I've scoured the internet and tried many different fixes, but to no avail...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来,您缺少JQuery,这是Bootstrap库的依赖性。根据此文档,您应该将其修改为
Seemingly, you're missing jQuery, which is the dependency of Bootstrap's library. According to this document, you should modify it to
您缺少jQuery,此示例可与Bootstrap V4一起使用(而不是Bootstrap V3)。
You're missing jQuery and this example works with Bootstrap v4 (instead of Bootstrap v3).