in English

Tuñiy

Huk pisi clasekunawan chaymanta JavaScript pluginsniykuwan tukuy proyectoykipi contenidopa rikuyninta tikray.

Imayna llamkan

JavaScript urmachiy plugin llamk'achisqa kachkan rikuchiypaq chaymanta pakaypaq. Botonkuna utaq anclakuna gatillokuna hina llamk'achkanku chaymanta elementokuna específicos kaqman mapeasqa kanku mayqinkunatachus tikranki. Huk elementota urmachispaqa heightkunan chanimanta 0. Imayna CSS kawsachiykunata hap'in chayta qusqa, mana paddinghuk .collapseelemento kaqpi llamk'achiy atikunkichu. Aswanpas, claseta huk sapanchasqa p'istu elemento hina llamk'achiy.

Kay componentepa animación efectonqa prefers-reduced-motionmedios tapuymanta hapirin. Yaykuna qillqaykumanta pisiyachisqa kuyuy t'aqapi qhaway .

Qatina

Uraypi kaq ñit'inakunata ñit'iy huk elementota rikuchinaykipaq chaymanta pakanaykipaq clase tikraykunawan:

  • .collapsecontenidota pakan
  • .collapsingtransiciones nisqapi churakun
  • .collapse.showcontenido nisqatam qawachin

Generalmente, huk ñit'inata data-targetatributowan llamk'achiyta yuyaychayku. Mana semántico qhawaymanta yuyaychasqa kaptinpas, huk t'inkitapas llamk'achiy atikunki hrefatributowan (hinallataq huk role="button"). Iskayninpipas, chay data-toggle="collapse"nisqa kamachisqa kachkan.

Some placeholder content for the collapse component. This panel is hidden by default but revealed when the user activates the relevant trigger.
<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">
    Some placeholder content for the collapse component. This panel is hidden by default but revealed when the user activates the relevant trigger.
  </div>
</div>

Kinranpa

Urmachiy pluginpas horizontal urmachiyta yanapan. Yanapakuq .widthclaseta yapay chaymanta tikraypaq widthchaymanta heightchuray widthchaymanta chaylla wawa elemento kaqpi. Ama hina kaspa kikiyki ruwasqa Sass qillqanaykipaq, chiru ukhupi estilokuna llamk'achiy, utaq ancho yanapakuyniyku llamk'achiy .

Ama hina kaspa, kay urapi kaq rikch'ana huk min-heighthuñuyuq kaptinpas, docsniykupi mana llumpay musuqmanta pinturakuna kananpaq, kayqa manam sut'imantachu mañasqa. Wawapi kaq widthelementollatam mañakun.

This is some placeholder content for a horizontal collapse. It's hidden by default and shown when triggered.
<p>
  <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseWidthExample" aria-expanded="false" aria-controls="collapseWidthExample">
    Toggle width collapse
  </button>
</p>
<div style="min-height: 120px;">
  <div class="collapse width" id="collapseWidthExample">
    <div class="card card-body" style="width: 320px;">
      This is some placeholder content for a horizontal collapse. It's hidden by default and shown when triggered.
    </div>
  </div>
</div>

Achka metakuna

A <button>utaq <a>achka elementokunata rikuchiyta chaymanta pakayta atin huk JQuery akllaqwan paypa hrefutaq data-targetatributonpi referenciaspa. Achka <button>utaq <a>huk elementota rikuchiyta chaymanta pakayta atin sichus sapankanku paykunap hrefutaq data-targetatributowan referencianku

Some placeholder content for the first collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
Some placeholder content for the second collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
<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">
        Some placeholder content for the first collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
      </div>
    </div>
  </div>
  <div class="col">
    <div class="collapse multi-collapse" id="multiCollapseExample2">
      <div class="card card-body">
        Some placeholder content for the second collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
      </div>
    </div>
  </div>
</div>

Ejemplo de acordeón

Tarjeta componente llamk'achispa , ñawpaqmanta urmachiy ruwayta mast'ariyta atikunki huk acordeón ruwanapaq. Acordeón estilo allinta aypanaykipaqqa, ama .accordionhina kaspa huk p’istu hina llamk’achiy.

Wakin churanakuna ñawpaq kaq acordeón panelpaq. Kay panelqa ñawpaqmanta rikuchikun, .showclaseman gracias nispa.

Some placeholder content for the second accordion panel. This panel is hidden by default.

And lastly, the placeholder content for the third and final accordion panel. This panel is hidden by default.
<div class="accordion" id="accordionExample">
  <div class="card">
    <div class="card-header" id="headingOne">
      <h2 class="mb-0">
        <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Collapsible Group Item #1
        </button>
      </h2>
    </div>

    <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
      <div class="card-body">
        Some placeholder content for the first accordion panel. This panel is shown by default, thanks to the <code>.show</code> class.
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-header" id="headingTwo">
      <h2 class="mb-0">
        <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Collapsible Group Item #2
        </button>
      </h2>
    </div>
    <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionExample">
      <div class="card-body">
        Some placeholder content for the second accordion panel. This panel is hidden by default.
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-header" id="headingThree">
      <h2 class="mb-0">
        <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
          Collapsible Group Item #3
        </button>
      </h2>
    </div>
    <div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordionExample">
      <div class="card-body">
        And lastly, the placeholder content for the third and final accordion panel. This panel is hidden by default.
      </div>
    </div>
  </div>
</div>

Accesibilidad nisqa

aria-expandedAswan allinta qhaway elemento de control nisqaman yapayta . Kay atributo explícitamente kunan estadota elemento colapsible controlman watasqa pantalla ñawiriqkunaman chaymanta rikch'aq yanapakuy tecnologiakunaman apachin. Sichus t'inkisqa elemento ñawpaqmanta wichq'asqa kachkan, kamachiy elementopi atributo chaniyuq kanan tiyan aria-expanded="false". Sichus t'inkisqa elementota kichasqa kananpaq churarqanki ñawpaqmanta showclase kaqwan, aria-expanded="true"kamachiypi churay chaymanta ranti. Plugin kikinmanta kay atributota kamachiypi tikranqa sichus utaq mana llañu elemento kichasqa utaq wichqasqa (JavaScript kaqninta, utaq imaraykuchus llamk'achiq huk kamachiy elementota llamk'achirqa chaymanta kikin llañu elementoman watasqa). Sichus kamachiq elementopa HTML elementon mana huk ñit'inachu (kayhina, huk <a>icha <div>), layarole="button"chay elementoman yapakunan tiyan.

Sichus kamachiy elementoyki huk sapalla ñit'iy atikuq elementota maskachkan – chaymanta data-targetatributo huk akllaqman rikuchichkan – atributota kamachiy elementoman idyapanayki tiyan , chaymanta chay de collapsible elemento kaqmanta. Kunan pantalla ñawiriqkuna chaymanta rikch'aq yanapakuy tecnologiakuna kay atributota llamk'achinku ruwaqkunaman yapa llalliq ñankuna qunankupaq chiqalla purinankupaq kikin elemento collapsible kaqman.aria-controlsid

Reparay Bootstrap kunan ruwaynin mana imaymana teclado tinkiykuna ARIA Qillqana Ruwaykuna Guía acordeón patrón kaqpi willasqa llanthunchu - kaykunata qam kikiyki JavaScript ruwasqawan churanayki tiyan.

Uso

Urmachiy plugin huk pisi clasekunata llamk'achin llasa hoqariyta llamk'achinapaq:

  • .collapsechaypi kaqta pakaykun
  • .collapse.showchaypi kaqta rikuchin
  • .collapsingtikray qallariptin yapasqa, tukuptintaq hurqusqa

Kay clasekunataqa tarinki _transitions.scss.

Atributos de datos nisqawan

Yanapakuylla data-toggle="collapse"chaymanta huk data-targetelementoman kikillanmanta huk utaq achka elementokuna collapsiblekuna kamachiyta churanapaq. Atributo data-targethuk CSS akllanata chaskikun chayman urmachiyta churanapaq. Aswan allinta yapay chay claseta collapsechay elemento collapsible nisqaman. Sichus ñawpaqmanta kichasqa kananta munanki, yapasqa claseta yapay show.

Acordeón hina huñu kamachiyta huk p'istuy kitiman yapanaykipaq, willay laya yapay data-parent="#selector". Kayta ruwaypi qhawanaykipaq demo nisqapi qhaway.

JavaScript nisqawan

Makiwan atichiy kaykunawan:

$('.collapse').collapse()

Akllanakuna

Akllanakuna willay layakuna utaq JavaScript kaqnintakama pasayta atikun. Willayta layakunapaq, akllana sutita yapay data-, imaynachus data-parent="".

Suti Niraq Ñawpaqchasqa Willay
tayta mama akllaq | jTapukuy objeto | Elemento DOM nisqa pantasqa Sichus tayta mama qusqa, chaymanta llapa t'inkisqa elementokuna nisqa tayta mamap urapi wichq'asqa kanqa mayk'aq kay t'inkisqa imayay rikuchisqa. card(ñawpamanta pacha acordeón ruwayman rikch'akuq - kayqa clasemanta dependen ). Atributoqa churasqa kanan tiyan chay meta collapsible nisqapi.
toggle nisqa boolean nisqa chiqaq Invocacionpi colapsible elementota tikran

Métodos

Métodos y transiciones asíncronas

Llapan API ruwanakuna mana sink'uyuq kanku chaymanta huk tikrayta qallarinku . Paykunaqa kutinku waqyaqman chaylla transición qallarisqa ichaqa manaraq tukukuchkaptin . Chaymantapas, huk tikray componente kaqpi huk método waqyay mana qhawasqachu kanqa .

Aswan willakuypaq JavaScript qillqaykuta qhaway .

.collapse(options)

Activates your content as a collapsible element. Accepts an optional options object.

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

.collapse('toggle')

Toggles a collapsible element to shown or hidden. Returns to the caller before the collapsible element has actually been shown or hidden (i.e. before the shown.bs.collapse or hidden.bs.collapse event occurs).

.collapse('show')

Shows a collapsible element. Returns to the caller before the collapsible element has actually been shown (i.e. before the shown.bs.collapse event occurs).

.collapse('hide')

Hides a collapsible element. Returns to the caller before the collapsible element has actually been hidden (i.e. before the hidden.bs.collapse event occurs).

.collapse('dispose')

Destroys an element’s collapse.

Events

Bootstrap’s collapse class exposes a few events for hooking into collapse functionality.

Event Type Description
show.bs.collapse Kay ruwayqa chaylla rawrarin mayk'aq showinstancia método waqyasqa.
rikuchisqa.bs.collapse Kay ruwayqa llamk'achisqa huk urmachiy elemento ruwaqman rikukuq ruwasqa kaqtin (CSS tikraykunata tukunanta suyanqa).
pakay.bs.ch'usaqyachiy Kay ruwayqa chaylla llamk'achisqa kachkan mayk'aqchus hidemétodo waqyasqa kachkan.
pakasqa.bs.collapse nisqa Kay ruwayqa llamk'achiqmanta huk urmachiy elemento pakasqa kaptin llamk'achisqa (CSS tikraykunata tukunanta suyanqa).
$('#myCollapsible').on('hidden.bs.collapse', function () {
  // do something...
})