Tuñiy
Huk pisi clasekunawan chaymanta JavaScript pluginsniykuwan tukuy proyectoykipi contenidopa rikuyninta tikray.
Uraypi kaq ñit'inakunata ñit'iy huk elementota rikuchinaykipaq chaymanta pakanaykipaq clase tikraykunawan:
.collapse
contenidota pakan.collapsing
transiciones nisqapi churakun.collapse.show
contenido nisqatam qawachin
Huk t'inkita llamk'achiyta atinki href
atributowan, icha huk ñit'inata data-target
atributowan. Iskayninpipas, chay data-toggle="collapse"
nisqa kamachisqa kachkan.
<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>
A <button>
utaq <a>
achka elementokunata rikuchiyta chaymanta pakayta atin huk JQuery akllaqwan paypa href
utaq data-target
atributonpi referenciaspa. Achka <button>
utaq <a>
huk elementota rikuchiyta chaymanta pakayta atin sichus sapankanku paykunap href
utaq data-target
atributowan referencianku
<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>
Tarjeta componente llamk'achispa , ñawpaqmanta urmachiy ruwayta mast'ariyta atikunki huk acordeón ruwanapaq.
<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>
aria-expanded
Aswan 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 show
clase kaqwan, aria-expanded="true"
kamachiypi churay chaymanta ranti. Plugin kikinmanta kay atributota kamachiypi tikranqa sichus utaq mana chay collapsible elemento kichasqa utaq wichqasqa (JavaScript kaqninta, utaq imaraykuchus llamk'achiq huk kamachiy elementota chaymanta kikin collapsbile elementoman watasqa kaqtapas llamk'achirqa). 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 llañu elementota qhawachkan – chaymanta data-target
atributo huk akllaqman rikuchichkan – atributota kamachiy elementoman id
yapanayki 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-controls
id
Reparay Bootstrap kunan ruwaynin mana imaymana teclado tinkiykuna WAI-ARIA Qillqana Ruwaykuna 1.1 acordeón patrón kaqpi willasqa llanthunchu - kaykunata qam kikiyki JavaScript ruwasqawan churanayki tiyan.
Urmachiy plugin huk pisi clasekunata llamk'achin llasa hoqariyta llamk'achinapaq:
.collapse
chaypi kaqta pakaykun.collapse.show
chaypi kaqta rikuchin.collapsing
tikray qallariptin yapasqa, tukuptintaq hurqusqa
Kay clasekunataqa tarinki _transitions.scss
.
Yanapakuylla data-toggle="collapse"
chaymanta huk data-target
elementoman kikillanmanta huk utaq achka elementokuna collapsiblekuna kamachiyta churanapaq. Atributo data-target
huk CSS akllanata chaskikun chayman urmachiyta churanapaq. Aswan allinta yapay chay claseta collapse
chay 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.
Makiwan atichiy kaykunawan:
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 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 .
Contenidoykita huk elemento collapsible hina activan. Huk akllana akllanakunata chaskikun object
.
Huk ñit'isqa elementota rikuchisqaman icha pakasqaman tikran. Llamaqman kutimun manaraq llalliq elemento chiqamanta rikuchisqa utaq pakasqa kachkaptin (icha manaraq shown.bs.collapse
utaq hidden.bs.collapse
ruway ruwakuchkaptin).
Huk llalliq elementota rikuchin. Llamaqman kutimun manaraq llalliq elemento chiqamanta rikuchisqa kachkaptin (icha manaraq shown.bs.collapse
ruway ruwakuchkaptin).
Huk llalliq elementota pakan. Llamaqman kutimun manaraq t'inkisqa elemento chiqamanta pakasqa kachkaptin (icha manaraq hidden.bs.collapse
ruway ruwakuchkaptin).
Huk elementopa urmayninta chinkachin.
Bootstrap kaqpa urmachiy clase huk pisi ruwaykunata riqsichin urmachiy ruwanaman enganche kaqpaq.
Tipo de Evento | Willay |
---|---|
rikuchiy.bs.collapse | Kay ruwayqa chaylla rawrarin show instancia método waqyasqa kaqtin. |
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 hide método waqyasqa kachkan. |
pakasqa.bs.collapse nisqa | Kay ruwayqa llamk'achiqmanta huk urmachiy elemento pakasqa kaptin llamk'achisqa (CSS tikraykunata tukunanta suyanqa). |