导航栏折叠按钮出现问题。
单击导航栏按钮后,我的导航栏折叠按钮将不会打开。我假设数据切换未触发崩溃是有问题的。
我也不确定ul标签中的PHP代码是否与之混淆。
谢谢您的帮助。
<html lang="en">
<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">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Quicksand:300,500" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lora:400,700|Montserrat:300" rel="stylesheet">
<script src="script.js"></script>
<title>MyCar</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="index.php">MyCar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="nav-item">
<a class="nav-link active" href="#">Home </a>
</li>
<li class="nav-item">
<a class="nav-link" href="cars.php">Search Cars </a>
</li>
<li class="nav-item ">
<a class="nav-link" href="sell.php">Sell Cars </a>
</li>
<li class="nav-item ">
<a class="nav-link" href="financing.php">Financing </a>
</li>
</ul>
<ul class="navbar-nav mt-2 mt-lg-0">
<?php
if(isset($_SESSION['username'])){
echo '<li class="nav-item">
<a class="nav-link" href="profile.php">Welcome, '.$_SESSION['username'].'<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="?logout=true">Log Out</a>
</li>'
;
}
else {
echo '<li class="nav-item">
<a class="nav-link" href="signup.php">Sign Up <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="login.php">Log In</a>
</li>';
}
?>
<!--<li class="nav-item">
<a class="nav-link" href='?logout=true'>>Log Out</a>
</li> -->
</ul>
</div>
</nav>
答案 0 :(得分:0)
您到Bootstrap.min.js的链接不正确
$
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js">
下面的代码段:
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>