Reputation: 1
I have a problem with the bootstrap navigation bar. I want to collapse the elements into Currently the navbar looks like this on mobile, as I would expect it: current state before clicking on the hamburger icon
After clicking on the Hamburger icon, it just went black. Currently the code is:
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="../css/index.css">
<script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<!--my script-->
<script src="../js/script.js"></script>
<title>Katholische Jugend Maudach</title>
</head>
<body>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-light bg-light sticky-top" role="navigation">
<a class="navbar-brand" href="../index.html">
<img src="../images/Logo.png" height="60px" width="60px" />
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="activities.html">Topic 2</a>
</li>
<li class="nav-item">
<a class="nav-link" href="downloads.html">Topic 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="about.html">Topic 3</a>
</li>
<li class="nav-item">
<a class="nav-link" href="quiz.html">Topic 4</a>
</li>
<li class="nav-item">
<a class="nav-link" href="impressum.html">Topic 5</a>
</li>
<li class="nav-item ">
<button class="btn btn-success" onclick="sendMail()">Contakt</button>
</li>
</ul>
</div>
</nav>
</div>
</body>
After clicking the hamburger icon the following happens. It just went black and only the button is shown.
after clicking the hamburger icon
Some further information besides the code:
onload
dynamically into the webpage with jquery (If the navbar changes, I have to alter just one file)If I should provide further information, please let me know.
Any hints are appreciated and thanks for your time.
Upvotes: 0
Views: 139
Reputation: 1
The code is working and the problem is in my custom CSS Stylesheet.
Upvotes: 0
Reputation: 227
Ideally, you should be placing your script CDNs at the end of the body, that too in a particular order. Something like this:
. . .
<script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</body>
I am not sure if this will help. Try this once.
Upvotes: 0