gpt4 book ai didi

bootstrap-4 - Bootstrap 4 导航栏切换器汉堡按钮不起作用

转载 作者:行者123 更新时间:2023-12-04 14:55:36 25 4
gpt4 key购买 nike

在移动 View 上,当我单击 nabar-toggler 按钮时,它会打开菜单,但当我再次单击它时,它不会关闭菜单。我不知道问题可能是什么?我检查了所有的 cdn 链接、编译的 css 以及除此之外的所有其他内容在应用程序中都运行良好。你们需要帮助!谢谢。

<!DOCTYPE html>
<html lang="en" class="full-height">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Brandon Matthews</title>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<!-- Material Design Bootstrap -->
<link href="./public/assets/css/compiled1.min.css" rel="stylesheet">
<!--My CSS-->
<link href="./public/assets/css/index.css">


</head>

<body>

<!-- Main navigation -->
<header>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark fixed-top scrolling-navbar">
<div class="container">
<a class="navbar-brand" href="#">Matthews Development</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#home">Home
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#about" data-offset="90">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#portfolio" data-offset="90">Projects</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact" data-offset="90">Contact</a>
</li>
</ul>
<!-- Social Icon -->
<ul class="navbar-nav nav-flex-icons">
<li class="nav-item">
<a class="nav-link" href="https://www.linkedin.com/in/brandon-matthews-b14165153/">
<i class="fa fa-linkedin white-text"></i>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/BrandonM25">
<i class="fa fa-github white-text"></i>
</a>
</li>
<li class="nav-item">
<a class="nav-link">
<i class="fa fa-facebook white-text"></i>
</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Navbar -->

最佳答案

我认为您没有导入此处提到的所有必要的引导 js 文件 (https://getbootstrap.com/docs/4.0/getting-started/introduction/#js)。

我为您的代码创建了一个 jdfiddle (https://jsfiddle.net/8vc79boj/8/) 并添加了 bootstrap 4 javascript 文件,它对我有用。

这些是我添加的脚本

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

关于bootstrap-4 - Bootstrap 4 导航栏切换器汉堡按钮不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50635024/

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