Navigation bar with more than one Dropbox in bootstrap

Asked

Viewed 307 times

0

I tried to create a navigation bar where you have the following columns: Home, Registration -> Customer registration and consultation -> Customer consultation. When I am in the query menu I cannot access the dropdown of the customer registration. Because?

    <title>Despesas</title>

    <!-- jquery - link cdn -->
    <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>

    <!-- bootstrap - link cdn -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

</head>

<body>

    <!-- Static navbar -->
<!-- Static navbar -->
    <nav class="navbar navbar-default navbar-static-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

                <ul class="nav navbar-nav">
                  <li><a href="home.php">Home</a></li>
                  <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">Cadastro
                    <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                      <li><a href="inserir_pessoa.php">Cadastro de clientes</a></li>
                      <li><a href="#">x</a></li>
                    </ul>
                  </li>
                  <li class="dropdown active">
                    <a class="dropdown-toggle" data-toggle="pageSubmenu" href="#">Consultas
                    <span class="caret"></span></a>
                    <ul class="dropdown-menu" id="pageSubmenu">
                      <li><a href="consulta_clientes.php">Consulta de clientes</a></li>
                      <li><a href="#">x</a></li>
                  </ul>
                </ul>
            </div>

            <div id="navbar" class="navbar-collapse collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="sair.php">Sair</a></li>
                </ul>
            </div><!--/.nav-collapse -->
        </div>
    </nav>

            <table class="table">
        <thread>
            <tr>
                <th>Nome</th>
                <th>Data de nascimento</th>
                <th>Telefone</th>
                <th>Endereço</th>
                <th>Editar</th>
                <th>Excluir</th>
            </tr>
        </thread>
        <tbody>
            <?php

            foreach($grupo as $pessoa){ ?>

                <tr>
                    <td> <?=$pessoa["nome"]?> </td>
                    <td> <?=$pessoa["nascimento"]?> </td>
                    <td> <?=$pessoa["telefone"]?> </td>
                    <td> <?=$pessoa["endereco"]?></td>
                    <td></td>
                    <td></td>
                </tr>


            <?php

            }

            ?>

</body>

  • See if you are returning error on Console.

  • I tested your code and it works fine as long as bootstrap.js is loaded after jquery.

  • Strange. when I’m on Nav Query I can’t access it itself or the client register. Nothing returns on the console. @Paulo bootstrap is being loaded dps from jquery

  • Does this happen after clicking the link, changing page? You are loading the files on all pages or only on the first page?

  • I press on all.

  • Publish your entire HTML including with <head> will facilitate to give you an accurate answer.

  • I edited with the entire content.

Show 2 more comments

1 answer

0

On all pages containing this menu, bootstrap.css, jquery.js and bootstrap.js files or their minimal versions (.min.css or .min.js must be loaded.)

<link rel="stylesheet" href="bootstrap.min.css" />
<script src="jquery.min.js"></script> 
<script src="bootstrap.min.js"></script>

jQuery.js should always be loaded before Bootstrap.js

  • Strange that I am loading the bootstrap in all pages, jquery tbm

Browser other questions tagged

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