0
On a One Page site, I implemented this Collapse Menu
<nav class="navbar navbar-expand-sm bg-nav navbar-dark fixed-top">
<a class="navbar-brand" href="#">
<img class="logo" src="images/logo.jpg" alt="logo">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#section2">Quem Somos</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#section3">Nossos Serviços</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#section4">Nossos Clientes</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#section5">Contatos</a>
</li>
</ul>
</div>
</nav>
CSS and JS are these:
<head>
<title>Meu Site.</title>
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<style>
body {height: 100%;width: 100%;}
html {height: 100%;width: 100%;}
form{height: 100%;padding-bottom: 250px;}
.bg-nav{background-color:#077877!important}
@media (max-width:667px) {
img.logo{width: auto; height: 40px;}
.desfault-section{padding-top: 65px;padding-bottom: 20px;}
}
@media (min-width:668px) {
img.logo{width: auto; height: 60px;}
.desfault-section{padding-top: 90px;padding-bottom: 20px;}
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
When it is displayed on a mobile screen, the menu opens by clicking on the 3 bars, however, when choosing an item from the menu, it should automatically collect without having to click on the 3 bars and, this is not happening.
Somebody give me a light?
If the anchor goes to the same page it should be necessary to insert the event in each button
– Rui Borges
Amigo edits your question and puts your CSS and the Script of this Menu, without it it is not possible to give you an exact answer
– hugocsl
Sam, this post you indicated solved the problem. Very Grateful.
– Gilberto Santos