I am trying to setup a hamburger menu using bootstrap. I went through my code, added in the css and js files, and the menu does not work i.e. it does not expand. I have used the example code from the bootstrap website. Any help would be appreciated to resolve this.
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>IDS PANEL CONFIG</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
</head>
<body>
<div >
<div id="navbarToggleExternalContent">
<div >
<h5 >Collapsed content</h5>
<span >Toggleable via the navbar brand.</span>
</div>
</div>
<nav >
<button type="button" data-toggle="collapse" data-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
<span ></span>
</button>
</nav>
<div>
<h1 style="font-size:50px;">CONFIG</h1>
<p style="font-size:50px;color: crimson;">Zone report</p>
<p><strong> please wait...</strong></p>
</div>
</div>
<div class = "container"></div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body>
</html>
CodePudding user response:
You are using Bootstrap version 5 but your code is for version 4.
If you change data-toggle
to data-bs-toggle
and data-target
to data-bs-target
it should work.