Collapse bootstrap is not closing

2

I'm using the following code to do a Collapse with bootstrap, it opens normally but does not close when clicking again, can anyone help me?

      <div class="well">
            <button href="#task" data-toggle="collapse" class="btn btn-default" type="button">
                Mostrar tarefas <span class="badge">{{$tasks->count()}}</span>
            </button>
            <div ><br/>
                <div id="task" class="collapse row">
                    @foreach($tasks as $task)
                        <div class="col-md-4">
                            <div class="panel panel-warning">
                                <div class="panel-heading">{{$task->title}}<a href="/tasks/detail/{{$task->id}}"
                                                                              class="btn btn-xs btn-default float-right"
                                                                              title="Ver tarefa"><i
                                                class="fa fa-bell"></i>
                                    </a>
                                </div>
                                <div class="panel-body">
                                    {!! $task->description !!}
                                </div>
                            </div>
                        </div>
                    @endforeach
                </div>
            </div>
        </div>
    
asked by anonymous 19.09.2016 / 21:32

1 answer

2

Its architecture is a bit wrong and missing some parameters, follow the examples found on the bootstrap site:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><linkrel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><aclass="btn btn-primary" role="button" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
  Link with href
</a>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
  Button with data-target
</button>
<div class="collapse" id="collapseExample">
  <div class="well">
    ...
  </div>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><linkrel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><divclass="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
  <div class="panel panel-default">
    <div class="panel-heading" role="tab" id="headingOne">
      <h4 class="panel-title">
        <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Title
        </a>
      </h4>
    </div>
    <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
      <div class="panel-body">
        Description
      </div>
    </div>
  </div>
</div>
    
19.09.2016 / 21:40