Expand and Collect div

Asked

Viewed 802 times

0

I have a div (#Adm) that shows me the result of all registered users and in front a button to unlock or block the user. How do I click it, make it expand and retract showing the results ?

<div id="adm">
    <?php
        include 'script/php/conn_padrao.php';
        $select_user = $mysqli->query("SELECT * FROM cadastros ORDER BY id DESC ");
        if (mysqli_num_rows($select_user) >= 1) {
            while ($res_user = $select_user->fetch_array()) {
                $id_user = $res_user['id'];
                $nome_user = $res_user['nome'];
                $banido = $res_user['block'];
                $uper_ban = strtoupper($banido);

                echo " $nome_user" . " - " . "Acesso Bloqueado:" . " " . "<a href='script/php/bloqueia_user.php?id=$id_user&block=$banido'>$uper_ban</a><br>";
            }
        }else{
            echo "VOCÊ NÃO POSSUI USUARIOS CADASTRADO !";
        }
    ?>
</div>

1 answer

1


You can use the Collapse Bootstrap to create a container that opens and closes.

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<p>
  <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#adm" aria-expanded="false" aria-controls="collapseExample">
    Mostrar/ocultar container
  </button>
</p>
<div class="collapse" id="adm">
  <div class="card card-body">
    Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
  </div>
</div>

  • 2

    Perfect. Really would be all I needed. Thank you

  • There would be no way to do it using accordion, those clickable arrows that Jah suggests to the user, option using css or Javascript?

  • @Itwasn'tme depends on what the user wants. He said he wanted a collapsible window, and that’s what I put in the answer.

Browser other questions tagged

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