How to make my menu work on all pages

Asked

Viewed 307 times

2

In my system, I have a menu, which works perfectly, but I’m trying to include a dropdown, with more links, the dropdown works only when I’m on the menu page, when I’m on other pages, the dropdown doesn’t work. Example: When I open the menu.php,the drop, it works, when I go to any other page, the links work normally, only the drop that does not.

<!DOCTYPE html>
<html>
 <head>
  <meta http-equiv=Content-Type content="text/html; charset=utf-8"> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <title> Menu </title>
  <link rel="stylesheet" href="css/bootstrap.min.css">
  <script type="text/javascript"  src="js/jquery.min.js"></script>
  <script type="text/javascript"  src="js/bootstrap.min.js"></script>
  <script type="text/javascript"  src="js/comandos.js"></script>
  <link rel="stylesheet" href="css/menu.css">
  <link rel="stylesheet" href="css/mobile/portrait.css" media="screen and (orientation: portrait)">
  <link rel="stylesheet" href="css/mobile/landscape.css" media="screen and (orientation: landscape)">
 </head>
 <body onmousemove="acao();"> <!-- Função acao() faz verificação de ociosidade no painel, após determinado tempo ele fecha. -->
   <div class="container-fluid">
    <nav class="navbar navbar-expand-sm bg-dark navbar-dark ">
      <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="inicio.php"><img src="logo/geral.png" /> Início</a>
          </li>
          <li class="nav-item <?php echo $show; ?>">
            <a class="nav-link" href="requisicao.php"><img src="logo/abastecimento.png" /> Abastecimento</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="dashboard.php"><img src="logo/relatorio.png" /> Relatórios</a>
          </li>
          <li class="nav-item ">
            <a class="nav-link" href="descontos.php" ><img src="logo/desconto.png" /> Descontos</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="diaria.php"><img src="logo/diaria.png" /> Diária/Lanche</a>
          </li>
          <li class="nav-item <?php echo $show; ?>">
            <a class="nav-link" href="postos.php"><img src="logo/posto.png" /> Postos</a>
          </li>
          <li class="nav-item ">
            <a class="nav-link" href="exames.php" ><img src="logo/exames.png" /> Exames</a>
          </li>
          <li class="nav-item  <?php echo $show; ?>">
            <a class="nav-link" href="conferencia.php" ><img src="logo/lupa.png" /> Conferencia</a>
          </li>
          <li class="nav-item  <?php echo $show; ?>">
            <a class="nav-link" href="configuracoes.php" ><img src="logo/outros.png" /> Configurações</a>
          </li>
          <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown">Descontos</a>
            <div class="dropdown-menu">
              <a class="dropdown-item" href="diaria.php">Link 1</a>
              <a class="dropdown-item" href="exames.php">Link 2</a> 
            </div>
          </li>
        </ul>
      </div>
      <div class="sair">
        <a href="func/f_parametros.php?func=sair"><img src="logo/sair.png" /> Sair</a>
      </div>
    </nav>
  </div>
 </body>
</html>

1 answer

1

Are you using some framework to do it? I think you’re forgetting to add some of these lines in <head> of the other pages:

    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script type="text/javascript"  src="js/jquery.min.js"></script>
    <script type="text/javascript"  src="js/bootstrap.min.js"></script>
    <script type="text/javascript"  src="js/comandos.js"></script>
    <link rel="stylesheet" href="css/menu.css">
    <link rel="stylesheet" href="css/mobile/portrait.css" media="screen and (orientation: portrait)">
    <link rel="stylesheet" href="css/mobile/landscape.css" media="screen and (orientation: landscape)">

Browser other questions tagged

You are not signed in. Login or sign up in order to post.