Source

Collapse

Toggle the visibility of content across your project with a few classes and our JavaScript plugins.

Exemplum

Preme tesserae infra monstrant et celant aliud elementum per mutationes ordinis:

  • .collapsecelat content
  • .collapsingapplicatur in transitus
  • .collapse.showostendit content

Vinculum uti potes cum hrefattributo, vel globo cum data-targetattributo. Utroque, opus data-toggle="collapse"est.

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.
<p>
  <a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" role="button" 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>
</p>
<div class="collapse" id="collapseExample">
  <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>

Multa scuta

A <button>vel <a>elementa multa monstrare et occultare possunt, ea referendo cum electore JQuery in suo hrefvel data-targetattributo. Multiplex <button>vel <a>demonstrare et abscondere elementum potest, si unumquemque referat cum suo hrefvel data-targetattributo

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.
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.
<p>
  <a class="btn btn-primary" data-toggle="collapse" href="#multiCollapseExample1" role="button" aria-expanded="false" aria-controls="multiCollapseExample1">Toggle first element</a>
  <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#multiCollapseExample2" aria-expanded="false" aria-controls="multiCollapseExample2">Toggle second element</button>
  <button class="btn btn-primary" type="button" data-toggle="collapse" data-target=".multi-collapse" aria-expanded="false" aria-controls="multiCollapseExample1 multiCollapseExample2">Toggle both elements</button>
</p>
<div class="row">
  <div class="col">
    <div class="collapse multi-collapse" id="multiCollapseExample1">
      <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>
  </div>
  <div class="col">
    <div class="collapse multi-collapse" id="multiCollapseExample2">
      <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>
  </div>
</div>

Accordion example

Utens charta componente, mores ruinae defaltae extendere potes ad concordiam creandam.

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Cibus truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua posuere avem ea squid single-origin coffee nulla assumenda litora et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan proident butcher vice lomo. Leggings eiusmod craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
<div id="accordion">
  <div class="card">
    <div class="card-header" id="headingOne">
      <h5 class="mb-0">
        <button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Collapsible Group Item #1
        </button>
      </h5>
    </div>

    <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
      <div class="card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-header" id="headingTwo">
      <h5 class="mb-0">
        <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Collapsible Group Item #2
        </button>
      </h5>
    </div>
    <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
      <div class="card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-header" id="headingThree">
      <h5 class="mb-0">
        <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
          Collapsible Group Item #3
        </button>
      </h5>
    </div>
    <div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordion">
      <div class="card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
</div>

Accessibility

Vide ut aria-expandedelementum ad imperium addere. Hoc attributum explicite significat praesentem statum collapsibilis elementi ligatum ad potestatem legentium protegendi et similes technologias adiuvandas. Si elementum collapsibile clauditur per defaltam, attributum in elementi potestate valorem habere debet aria-expanded="false". Si elementum collapsibile posueris ut pateat per defaltam utens showclassium, aria-expanded="true"in dicione pones. Plugin sponte toggle hoc attributum in potestate fundatur utrum elementum collapsibile vel non apertum vel clausum (per JavaScript, vel quia utens utitur alia potestate elementi etiam ad idem collapsbile elementum ligatum). Si elementum HTML elementi potestate non est felis (exempli gratia, an <a>vel <div>) attributumrole="button"addatur elemento.

Si elementum imperium tuum unum elementum collapsibile oppugnat - id est data-targetattributum designat idelectoris - attributum debetis elementi temperantiae, elementi collapsibilis aria-controlscontinentis . idLectores screen moderni et similes technologiae adiuvantes hoc attributo utuntur ut usores cum brevibus additis praebeant ut directe navigant ad elementum ipsum collapsibile.

Nota quod Bootstrap exsecutio currentis non tegit varias interationes claviaturas descriptos in WAI-ARIA Authoring Exercitia 1.1 exemplaris accordionis - has te includere oportet cum usu JavaScript.

Consuetudinem

In ruina plugin paucae classes adhibet ad tractandum elevatio gravis;

  • .collapsecelat contentus
  • .collapse.showostendit contentus
  • .collapsingadditur quando transitus incipit, et quando finitur removetur

Hae classes reperiuntur in _transitions.scss.

Via data attributa

Adde data-toggle="collapse"modo et data-targetelemento, ut automatice imperium unum vel plura elementa collapsibilia assignent. Attributum data-targetCSS electrix acceptat ut ruinam adhiberet. Adde genus collapseelementi collapsibili. Si vis aperta defaltam facere, additamenta classis adde show.

Accordion-similis coetus administrationem addere aream collapsibilem, data attributum addere data-parent="#selector". Hoc in actione refer ad demo.

Via JavaScript

Admitte cum manually:

$('.collapse').collapse()

Optiones

Optiones transigi possunt per data attributa vel JavaScript. Data enim attributa, adiungunt optionis nomen data-, ut in data-parent="".

Nomen Type Default Descriptio
parent selector | jQuery object | dom elementum falsus Si parens provideatur, omnia elementa collapsibilia sub parente praefinito claudentur, cum haec collapsibilis item demonstratur. (similis morum accordion traditio - hoc genus dependet card). Attributum in area scopo collapsibile apponendum est.
toggle Boolean verum Toggles collapsible elementum in invocatione

Methodi

Modi asynchronous et transitus

Omnes API modi asynchroni sunt et transitus committitur . Redeunt ad RECENS mox ut transitus incipiat sed antequam finiatur . Methodus praeterea in transitus transeuntis ignorabitur .

Videre documenta nostra JavaScript pro magis notitia.

.collapse(options)

Contentum actuat tuum ut collapsibile elementum. Acceptat optiones libitum object.

$('#myCollapsible').collapse({
  toggle: false
})

.collapse('toggle')

Toggles collapsibile elementum est ut vel absconditum ostendatur. RECENS, antequam elementum collapsibile redit, actu ostensum est vel absconditum (id est ante eventum shown.bs.collapsevel hidden.bs.collapseeventum).

.collapse('show')

Elementum collapsibile ostendit. RECENS redit ad elementum collapsibile antequam actu ostensum est (id est antequam shown.bs.collapseevenit).

.collapse('hide')

Cras lacinia elementum consequat. Recurrit ad RECENS antequam elementum collapsibile actu absconditum (id est antequam hidden.bs.collapseevenit).

.collapse('dispose')

Destruit elementum ruina.

Events

Classis ruina Bootstrap paucas eventus exponit pro hamo in ruina functionis.

Event Type Descriptio
show.bs.collapse Huius rei accendit statim cum showinstantia methodus appellatur.
shown.bs.collapse Eventus hic accensus est cum elementum ruinae usoris manifestatum est (exspectabit CSS transitus ad perficiendum).
hide.bs.collapse Ea res statim cum hidemodus vocatus est accenditur.
hidden.bs.collapse Eventus hic accensus est cum elementum ruinae ab utentis absconditum est (exspectabit CSS transitus ad perficiendum).
$('#myCollapsible').on('hidden.bs.collapse', function () {
  // do something…
})