Ijaarsi kufuu
Mul'achuu qabiyyee pirojektii kee guutuu keessatti gita muraasaa fi ifteessitoota JaavaScript keenyaan jijjiiri.
Qaaqa biraa karaa jijjiirama gitaa agarsiisuu fi dhoksuuf qareewwan armaan gadii cuqaasi:
.collapse
qabiyyee dhoksa.collapsing
yeroo ce’umsaa hojiirra oola.collapse.show
qabiyyee agarsiisa
href
Hidhaa amaloota waliin, ykn qaree amaloota waliin fayyadamuu dandeessa data-target
. Haala lamaan keessatti, the data-toggle="collapse"
ni barbaachisa.
<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>
ykn <a>
elementoota hedduu agarsiisuu fi dhoksuu danda'a filannoo JQuery amaloota isaa href
ykn keessatti wabeeffachuun. data-target
Dachaa <button>
ykn <a>
elementii agarsiisuu fi dhoksuu danda'u yoo tokkoon tokkoon isaanii amaloota isaanii href
ykn waliin wabeeffatandata-target
<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>
Qaama kaardii fayyadamuun , amala kufaatii durtii dheeressuun akkoordiyoon uumuu dandeessa.
<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
Qaama too'annoo irratti dabaluu kee mirkaneessi . Amalli kun haala ammaa elementii kufaatii to'annootti hidhamee dubbistoota iskiriinii fi teeknooloojiiwwan gargaarsaa walfakkaatan ifatti dabarsa. Yoo qaamni cufamuu danda'u durtiidhaan cufame, amalli qaama too'annoo irratti gatii aria-expanded="false"
. Yoo qaama kuffamuu danda'u akka durtii show
gita fayyadamuun banamu saagde, aria-expanded="true"
bakka isaa too'annoo irratti saagi. Ijaarsichi ofumaan amalli kana too'annoo irratti qaamni kuffamuu danda'u banamuu ykn cufamuu dhabuu irratti hundaa'uun ni jijjiira (karaa JaavaScript, ykn sababni isaas fayyadamaan qaama too'annoo biraa akkasumas qaama collapsbile walfakkaataa waliin hidhame kakaase). Yoo qaamni HTML qaama too'annoo qaree hin taane (fkn, an <a>
ykn <div>
), amallirole="button"
elementii irratti dabalamuu qaba.
Yoo qaamni too'annoo kee qaama cufamuu danda'u tokko irratti xiyyeeffate – jechuunis data-target
amalli gara filannootti agarsiisaa jira ta'e – amalli qaama too'annootti id
dabaluu qabda , kan qaama kuffamuu danda'u of keessaa qaba. Dubbistoonni iskiriinii ammayyaa fi teeknooloojiiwwan gargaarsaa walfakkaatan amaloota kana fayyadamuun fayyadamtootaaf karaa gabaabaa dabalataa kallattiin gara elementii kufaatii mataa isaatti akka qajeelan ni kennu.aria-controls
id
Hubadhu hojiirra oolmaan Bootstrap ammaa walqunnamtii furtuu adda addaa shaakala akkoordiyoonii WAI-ARIA Shaakala Barreessuu 1.1 keessatti ibsame hin uwwisu - kana ofuma keetii JaavaScript amala waliin hammachuu si barbaachisa.
Ijaarsiin kufaatii gita muraasa fayyadama kaasuun ulfaataa to'achuuf:
.collapse
qabiyyee dhoksa.collapse.show
qabiyyee agarsiisa.collapsing
yeroo ce'umsi jalqabu dabalama, yeroo xumuramu immoo ni haqama
Kutaawwan kunniin _transitions.scss
.
Too'annoo elementoota tokkoo fi isaa ol ofumaan ramaduuf elementicha irratti data-toggle="collapse"
fi a qofa dabaluu qofa . data-target
Amalli data-target
filannoo CSS kufaatii itti hojii irra oolchuuf fudhata. collapse
Gitaa gara qaama cufamuu danda'utti dabaluu kee mirkaneessi . Yoo durtii akka banamu barbaadde, gita dabalataa dabali show
.
Bulchiinsa garee akka akkoordiyoonii gara naannoo cufamuu danda'utti dabaluuf, amalli deetaa dabali data-parent="#selector"
. Kana hojiidhaan ilaaluuf demoo ilaalaa.
Harkaan dandeessisi:
Filannoon karaa amaloota deetaa ykn JaavaScript darbuu danda'u. Amaloota deetaatiif, maqaa filannoo gara data-
, akkuma keessatti dabali data-parent=""
.
Maqaa | Akaakuu | Durtii dha | Ibsa |
---|---|---|---|
warra | filannoo | jWanti gaaffii | Qaama DOM | soba | Yoo warri kenname, kana booda qaamolee kuffamuu danda'an hundi warra ifteessame jala jiran yeroo wanti cufamuu danda'u kun agarsiifamu ni cufamu. (amala akkoordiyoonii aadaa wajjin wal fakkaata - kun card daree irratti hundaa'a). Amalli naannoo galmee kuffamuu danda'u irratti saagamuu qaba. |
toggle jechuun ni danda'ama | boolee | dhugaa | Waamicha irratti qaama kuffamuu danda'u jijjiira |
Malawwanii fi ce’umsawwan wal hin simne
Malleen API hundi wal hin simnee fi ce'umsa jalqabu . Akkuma ce'umsi jalqabame garuu osoo hin xumuramin gara nama bilbileetti deebi'u . Dabalataan, waamichi malaa qaama ce'umsaa irratti ni tuffatama .
Qabiyyee kee akka qaama cufamuu danda'utti hojii irra oolcha. Filannoo filannoo tokko fudhata object
.
Qaama kuffamuu danda'u gara agarsiifame ykn dhokfameetti jijjiira. Qabeentiin kuffamuu danda'u qabatamaan osoo hin agarsiifamiin ykn hin dhokatiin dura gara waamichaatti deebi'a (jechuunis osoo taatee shown.bs.collapse
ykn hin uumamin dura hidden.bs.collapse
).
Qabeentaa kuffamuu danda'u agarsiisa. Qaamni kuffamuu danda'u qabatamaan osoo hin agarsiifamiin dura gara waamichaatti deebi'a (jechuunis shown.bs.collapse
taatee osoo hin uumamin dura).
Qabeentaa kuffamuu danda'u dhoksa. Qabeentiin kuffamuu danda'u qabatamaan osoo hin dhokatiin dura (jechuunis hidden.bs.collapse
taatee osoo hin uumamin dura) gara waamichaatti deebi'a.
Kufaatii elementii tokkoo ni balleessa.
Gitni kufaatii Bootstrap taateewwan muraasa gara dalagaa kufaatiitti hooking gochuuf saaxila.
Gosa Taatee | Ibsa |
---|---|
agarsiisa.bs.kufaatii | Taatee kun yeroo show mala fakkeenyaa waamamu battalumatti dhukaasa. |
agarsiifame.bs.collapse | Taatee kun yeroo qaamni kufaatii fayyadamaaf mul'atu taasifamu dhukaafama (ce'umsa CSS xumuramuu eega). |
dhoksuu.bs.kuffisuu | Taatee kun yeroo hide mala waamame battalumatti dhukaafama. |
dhokataa.bs.kufaatii | Taatee kun yeroo qaamni kufaatii fayyadamaa irraa dhokate dhukaafama (ce'umsa CSS xumuramuu eega). |