Collapse bootstrap is not closing

Asked

Viewed 814 times

2

I’m using the following code to make a Collapse with bootstrap, it opens normally but does not close when clicking again, someone can 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>

1 answer

2


Its architecture is half wrong and missing some parameters, follow the own examples that are found on the bootstrap site:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="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>
<a class="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>
<link rel="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>

<div class="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>

  • 1

    Thanks for the help, but the problem was the google-Charts api I used, I changed my idea and ended up doing otherwise.

Browser other questions tagged

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