我正在使用引导程序来开发在线Web应用程序。导航无法正常工作,我尝试了一些操作,但是没有运气。我在静态目录中存储了引导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 © Maps Creators 2019</p></center>
</div>
<!-- /.container -->
</footer>
</body>
</html>
<style class="cp-pen-styles">
body
{
vertical-align: middle;
background: #27ae60;
}
我希望通过单击导航栏时向我显示其中的内容列表来使导航栏按预期工作。
答案 0 :(得分:1)
替换您的代码
<!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 © Maps Creators 2019</p></center>
</div>
<!-- /.container -->
</footer>
</body>
</html>