gpt4 book ai didi

python - Bootstrap 导航菜单下拉菜单不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 06:13:45 25 4
gpt4 key购买 nike

我正在使用 bootstrap 开发在线网络应用程序。导航不工作,我尝试了一些东西但没有运气。我的静态目录中存储了 bootstrap css 文件。

我的导航栏代码在下面

<!DOCTYPE html>
<html lang="en">
{%load staticfiles%}
<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">

<title>Maps - Map</title>

<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap core CSS -->
<link href="{% static '/css/bootstrap.min.css' %}" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="{% static 'css/2-col-portfolio.css' %}" rel="stylesheet">

</head>


<body>

<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="{% url 'polls:home' %}">FestiMaps</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="{% url 'polls:home' %}">Home
<span class="sr-only">(current)</span>
</a>
</li>

</ul>
</div>
</div>
</nav>


<center>
<div class = "section">
<iframe></iframe>
</div>
</center>








<footer class="py-5 bg-dark">
<div class="container">
<center><p class="m-0 text-center text-white">Copyright &copy; Maps Creators 2019</p></center>
</div>
<!-- /.container -->
</footer>


</body>

</html>


<style class="cp-pen-styles">
body
{
vertical-align: middle;
background: #27ae60;
}


当我点击导航栏时,我希望导航栏能按预期工作,向我显示其中的内容列表。

最佳答案

替换你的代码

<!DOCTYPE html>
<html lang="en">
{%load staticfiles%}
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Maps - Map</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{% url 'polls:home' %}">FestiMaps</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="{% url 'polls:home' %}">Home <span class="sr-only">(current)</span></a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<center>
<div class = "section">
<iframe></iframe>
</div>
</center>








<footer class="py-5 bg-dark">
<div class="container">
<center><p class="m-0 text-center text-white">Copyright &copy; Maps Creators 2019</p></center>
</div>
<!-- /.container -->
</footer>


</body>

</html>

关于python - Bootstrap 导航菜单下拉菜单不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56188931/

25 4 0