Source

Ijaarsi kufuu

Mul'achuu qabiyyee pirojektii kee guutuu keessatti gita muraasaa fi ifteessitoota JaavaScript keenyaan jijjiiri.

Akkaataa itti hojjetu

Ijaarsi JaavaScript kufaa qabiyyee agarsiisuu fi dhoksuuf fayyadama. Qabduu ykn ankuroonni akka kaka'umsaa kanneen elementoota murtaa'oo ati jijjiirtutti kaartaa ta'anitti fayyadamu. Elementii tokko kuffisuun heightgatii isaa ammaa irraa gara 0. Akkaataa CSS sochiiwwan itti qabatu kennameef, elementii paddingirratti fayyadamuu hin dandeessu . .collapseInumaayyuu, gita akka qaama marfata of danda'etti fayyadami.

Bu'aan sochii qaama kanaa prefers-reduced-motiongaaffii miidiyaa irratti hundaa'a. Kutaa sochii hir'ate sanada dhaqqabummaa keenyaa ilaali .

Fakkeenya

Qaaqa biraa karaa jijjiirama gitaa agarsiisuu fi dhoksuuf qareewwan armaan gadii cuqaasi:

  • .collapseqabiyyee dhoksa
  • .collapsingyeroo ce’umsaa hojiirra oola
  • .collapse.showqabiyyee agarsiisa

hrefHidhaa amaloota waliin, ykn qaree amaloota waliin fayyadamuu dandeessa data-target. Haala lamaan keessatti, the data-toggle="collapse"ni barbaachisa.

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>

Target dachaa

A <button>ykn <a>elementoota hedduu agarsiisuu fi dhoksuu danda'a filannoo JQuery amaloota isaa hrefykn keessatti wabeeffachuun. data-targetDachaa <button>ykn <a>elementii agarsiisuu fi dhoksuu danda'u yoo tokkoon tokkoon isaanii amaloota isaanii hrefykn waliin wabeeffatandata-target

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>

Fakkeenya akkoordiyoonii

Qaama kaardii fayyadamuun , amala kufaatii durtii dheeressuun akkoordiyoon uumuu dandeessa. Akkaataa accordion sirnaan galmaan ga'uuf, .accordionakka marfataatti fayyadamuu kee mirkaneessi.

Anim pariatur cliche reprehenderit, enim eiusmod jireenya olaanaa accusamus terry richardson ad squid. 3 lukkuu ji'a officia aute, non cupidat iskeetiiboordii dolor brunch. Konkolaataa nyaataa quinoa nesciunt laborum eiusmod. Brunch 3 lukkuu ji'a tempor, sunt aliqua simbirroo irra kaa'uu squid buna ka'umsa tokkoo nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, hojii biiraa hojii harkaa wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur foon qalaa itti aanaa lomo. Leggings occaecat hojii harkaa biiraa qonnaa-gara-minjaala, raw denim aesthetic synth nesciunt tarii waa'ee isaanii hin dhageenye accusamus labore itti fufiinsa 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 class="accordion" id="accordionExample">
  <div class="card">
    <div class="card-header" id="headingOne">
      <h2 class="mb-0">
        <button class="btn btn-link" 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">
        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">
      <h2 class="mb-0">
        <button class="btn btn-link 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">
        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">
      <h2 class="mb-0">
        <button class="btn btn-link 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">
        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>

Dhaqqabummaa

aria-expandedQaama 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 showgita 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-targetamalli gara filannootti agarsiisaa jira ta'e – amalli qaama too'annootti iddabaluu 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-controlsid

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.

Fayyadama

Ijaarsiin kufaatii gita muraasa fayyadama kaasuun ulfaataa to'achuuf:

  • .collapseqabiyyee dhoksa
  • .collapse.showqabiyyee agarsiisa
  • .collapsingyeroo ce'umsi jalqabu dabalama, yeroo xumuramu immoo ni haqama

Kutaawwan kunniin _transitions.scss.

Karaa amaloota deetaa

Too'annoo elementoota tokkoo fi isaa ol ofumaan ramaduuf elementicha irratti data-toggle="collapse"fi a qofa dabaluu qofa . data-targetAmalli data-targetfilannoo CSS kufaatii itti hojii irra oolchuuf fudhata. collapseGitaa 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.

Karaa JaavaScript

Harkaan dandeessisi:

$('.collapse').collapse()

Filannoowwan

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 jalatti yeroo wanti cufamuu danda'u kun agarsiifamu ni cufamu. (amala akkoordiyoonii aadaa wajjin wal fakkaata - kun carddaree 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

Malawwan

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 .

Odeeffannoo dabalataaf galmee JaavaScript keenya ilaali .

.collapse(options)

Qabiyyee kee akka qaama cufamuu danda'utti hojii irra oolcha. Filannoo filannoo tokko fudhata object.

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

.collapse('toggle')

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.collapseykn hin uumamin dura hidden.bs.collapse).

.collapse('show')

Qabeentaa kuffamuu danda'u agarsiisa. Qaamni kuffamuu danda'u qabatamaan osoo hin agarsiifamiin dura gara waamichaatti deebi'a (jechuunis shown.bs.collapsetaatee osoo hin uumamin dura).

.collapse('hide')

Qabeentaa kuffamuu danda'u dhoksa. Qabeentiin kuffamuu danda'u qabatamaan osoo hin dhokatiin dura (jechuunis hidden.bs.collapsetaatee osoo hin uumamin dura) gara waamichaatti deebi'a.

.collapse('dispose')

Kufaatii elementii tokkoo ni balleessa.

Taateewwan

Gitni kufaatii Bootstrap taateewwan muraasa gara dalagaa kufaatiitti hooking gochuuf saaxila.

Gosa Taatee Ibsa
agarsiisa.bs.kufaatii Taatee kun yeroo showmala 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 hidemala waamame battalumatti dhukaafama.
dhokataa.bs.kufaatii Taatee kun yeroo qaamni kufaatii fayyadamaa irraa dhokate dhukaafama (ce'umsa CSS xumuramuu eega).
$('#myCollapsible').on('hidden.bs.collapse', function () {
  // do something…
})