下拉按钮在 Bootstrap 5.3 上不起作用

问题描述 投票:0回答:1

我正在使用 Express、EJS 和 bootstrap 制作一个网站,但下拉按钮不起作用

代码:

<%- include('../includes/head') %>
<div class="dropdown">
    <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">Dropdown button</button>

    <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
        <li><a class="dropdown-item" href="#">Action</a></li>
        <li><a class="dropdown-item" href="#">Another action</a></li>
        <li><a class="dropdown-item" href="#">Something else here</a></li>
    </ul>
</div>
<%- include('../includes/footer') %>

头:

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

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">

  <title>Title</title>
</head>

<body>

页脚:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body>

</html>

当我单击按钮时,它不显示下拉菜单的内容

bootstrap-5
1个回答
0
投票

我不知道这是否重要/有效,但尝试将引导脚本从页脚移动到页眉,它可能基于加载顺序。

© www.soinside.com 2019 - 2024. All rights reserved.