SourceRondedzera boka
Mapoka ezvirongwa chinhu chinochinjika uye chine simba chekuratidza zvakatevedzana zvemukati. Shandura uye uwedzere iwo kuti atsigire zvingangoita chero zviri mukati.
Basic muenzaniso
Boka rinonyanya kukosha irondedzero isina kurongeka ine zvinyorwa uye makirasi akakodzera. Vaka pamusoro payo nesarudzo dzinotevera, kana neCSS yako sezvinodiwa.
Cras justo odio
Dapibus ac facilisis in
Morbi leo risus
Porta ac consectetur ac
Vestibulum uye eros
Copy
<ul class= "list-group" >
<li class= "list-group-item" > Cras justo odio</li>
<li class= "list-group-item" > Dapibus ac facilisis in</li>
<li class= "list-group-item" > Morbi leo risus</li>
<li class= "list-group-item" > Porta ac consectetur ac</li>
<li class= "list-group-item" > Vestibulum at eros</li>
</ul>
Active zvinhu
Wedzera .active
kune a .list-group-item
kuratidza ikozvino inoshanda sarudzo.
Cras justo odio
Dapibus ac facilisis in
Morbi leo risus
Porta ac consectetur ac
Vestibulum uye eros
Copy
<ul class= "list-group" >
<li class= "list-group-item active" > Cras justo odio</li>
<li class= "list-group-item" > Dapibus ac facilisis in</li>
<li class= "list-group-item" > Morbi leo risus</li>
<li class= "list-group-item" > Porta ac consectetur ac</li>
<li class= "list-group-item" > Vestibulum at eros</li>
</ul>
Zvinhu zvakaremara
Wedzera .disabled
kune a .list-group-item
kuti iite seyakaremadzwa. Ziva kuti zvimwe zvinhu zvine .disabled
zvinozodawo tsika JavaScript kudzima zvizere zviitiko zvavo zvekudzvanya (semuenzaniso, zvinongedzo).
Cras justo odio
Dapibus ac facilisis in
Morbi leo risus
Porta ac consectetur ac
Vestibulum uye eros
Copy
<ul class= "list-group" >
<li class= "list-group-item disabled" aria-disabled= "true" > Cras justo odio</li>
<li class= "list-group-item" > Dapibus ac facilisis in</li>
<li class= "list-group-item" > Morbi leo risus</li>
<li class= "list-group-item" > Porta ac consectetur ac</li>
<li class= "list-group-item" > Vestibulum at eros</li>
</ul>
Shandisa <a>
s kana <button>
s kugadzira zvinogoneka rondedzero yeboka zvinhu zvine hover, yakaremara, uye inoshanda nyika nekuwedzera .list-group-item-action
. Isu tinopatsanura aya emanyepo-makirasi kuti tive nechokwadi chemapoka akagadzirwa neasina-anopindirana zvinhu (senge <li>
s kana <div>
s) haape kudzvanya kana kudzvanya kugona.
Iva nechokwadi chekusashandisa .btn
makirasi akajairwa pano .
Copy
<div class= "list-group" >
<a href= "#" class= "list-group-item list-group-item-action active" >
Cras justo odio
</a>
<a href= "#" class= "list-group-item list-group-item-action" > Dapibus ac facilisis in</a>
<a href= "#" class= "list-group-item list-group-item-action" > Morbi leo risus</a>
<a href= "#" class= "list-group-item list-group-item-action" > Porta ac consectetur ac</a>
<a href= "#" class= "list-group-item list-group-item-action disabled" tabindex= "-1" aria-disabled= "true" > Vestibulum at eros</a>
</div>
Ne <button>
s, iwe unogona zvakare kushandisa disabled
hunhu pachinzvimbo .disabled
chekirasi. Zvinosuruvarisa, <a>
s haitsigire vakaremara hunhu.
Cras justo odio
Dapibus ac facilisis in
Morbi leo risus
Porta ac consectetur ac
Vestibulum uye eros
Copy
<div class= "list-group" >
<button type= "button" class= "list-group-item list-group-item-action active" >
Cras justo odio
</button>
<button type= "button" class= "list-group-item list-group-item-action" > Dapibus ac facilisis in</button>
<button type= "button" class= "list-group-item list-group-item-action" > Morbi leo risus</button>
<button type= "button" class= "list-group-item list-group-item-action" > Porta ac consectetur ac</button>
<button type= "button" class= "list-group-item list-group-item-action" disabled > Vestibulum at eros</button>
</div>
Flush
Wedzera .list-group-flush
kuti ubvise mamwe mabhodha uye makona akatenderedzwa kupa runyorwa zvinhu zveboka kumucheto-kune-kumucheto mumudziyo wevabereki (semuenzaniso, makadhi).
Cras justo odio
Dapibus ac facilisis in
Morbi leo risus
Porta ac consectetur ac
Vestibulum uye eros
Copy
<ul class= "list-group list-group-flush" >
<li class= "list-group-item" > Cras justo odio</li>
<li class= "list-group-item" > Dapibus ac facilisis in</li>
<li class= "list-group-item" > Morbi leo risus</li>
<li class= "list-group-item" > Porta ac consectetur ac</li>
<li class= "list-group-item" > Vestibulum at eros</li>
</ul>
Horizontal
Wedzera .list-group-horizontal
kuti uchinje marongero ezvinyorwa zveboka kubva pakatwasuka kuenda kune yakachinjika pamapoinzi ese. Neimwe nzira, sarudza chinodaira chinodavirwa .list-group-horizontal-{sm|md|lg|xl}
kuita boka rerondedzero rakachinjika kutanga pabreakpoint's min-width
. Parizvino mapoka emazita akachinjika haagone kusanganiswa nemapoka erunyoro.
ProTip: Unoda kuenzana-hupamhi rondedzero yeboka zvinhu kana yakachinjika? Wedzera .flex-fill
kune chimwe nechimwe cheboka chinhu.
Cras justo odio
Dapibus ac facilisis in
Morbi leo risus
Copy
<ul class= "list-group list-group-horizontal" >
<li class= "list-group-item" > Cras justo odio</li>
<li class= "list-group-item" > Dapibus ac facilisis in</li>
<li class= "list-group-item" > Morbi leo risus</li>
</ul>
Cras justo odio
Dapibus ac facilisis in
Morbi leo risus
Copy
<ul class= "list-group list-group-horizontal-sm" >
<li class= "list-group-item" > Cras justo odio</li>
<li class= "list-group-item" > Dapibus ac facilisis in</li>
<li class= "list-group-item" > Morbi leo risus</li>
</ul>
Cras justo odio
Dapibus ac facilisis in
Morbi leo risus
Copy
<ul class= "list-group list-group-horizontal-md" >
<li class= "list-group-item" > Cras justo odio</li>
<li class= "list-group-item" > Dapibus ac facilisis in</li>
<li class= "list-group-item" > Morbi leo risus</li>
</ul>
Cras justo odio
Dapibus ac facilisis in
Morbi leo risus
Copy
<ul class= "list-group list-group-horizontal-lg" >
<li class= "list-group-item" > Cras justo odio</li>
<li class= "list-group-item" > Dapibus ac facilisis in</li>
<li class= "list-group-item" > Morbi leo risus</li>
</ul>
Cras justo odio
Dapibus ac facilisis in
Morbi leo risus
Copy
<ul class= "list-group list-group-horizontal-xl" >
<li class= "list-group-item" > Cras justo odio</li>
<li class= "list-group-item" > Dapibus ac facilisis in</li>
<li class= "list-group-item" > Morbi leo risus</li>
</ul>
Contextual classes
Shandisa makirasi emamiriro ekugadzirisa zvinhu kurongedza zvinhu zvine mamiriro ekunze uye ruvara.
Dapibus ac facilisis in
Chinhu chakareruka chekutanga cheboka
Chinhu chakareruka chechipiri cheboka
Chinhu cheboka chekubudirira chiri nyore
Chinhu cheboka chenjodzi chiri nyore
Chinhu cheboka chenyevero chiri nyore
Chinhu chakareruka cheruzivo cheboka
Chinhu cheboka chakareruka chechiedza
Chinhu chiri nyore chakasviba cheboka
Copy
<ul class= "list-group" >
<li class= "list-group-item" > Dapibus ac facilisis in</li>
<li class= "list-group-item list-group-item-primary" > A simple primary list group item</li>
<li class= "list-group-item list-group-item-secondary" > A simple secondary list group item</li>
<li class= "list-group-item list-group-item-success" > A simple success list group item</li>
<li class= "list-group-item list-group-item-danger" > A simple danger list group item</li>
<li class= "list-group-item list-group-item-warning" > A simple warning list group item</li>
<li class= "list-group-item list-group-item-info" > A simple info list group item</li>
<li class= "list-group-item list-group-item-light" > A simple light list group item</li>
<li class= "list-group-item list-group-item-dark" > A simple dark list group item</li>
</ul>
Contextual makirasi anoshandawo ne .list-group-item-action
. Cherechedza kuwedzera kwezvitaera zvehover pano hazvipo mumuenzaniso wapfuura. Uyewo inotsigirwa ihurumende .active
; shandisa kuratidza sarudzo inoshanda pachinhu cheboka rezvinyorwa.
Copy
<div class= "list-group" >
<a href= "#" class= "list-group-item list-group-item-action" > Dapibus ac facilisis in</a>
<a href= "#" class= "list-group-item list-group-item-action list-group-item-primary" > A simple primary list group item</a>
<a href= "#" class= "list-group-item list-group-item-action list-group-item-secondary" > A simple secondary list group item</a>
<a href= "#" class= "list-group-item list-group-item-action list-group-item-success" > A simple success list group item</a>
<a href= "#" class= "list-group-item list-group-item-action list-group-item-danger" > A simple danger list group item</a>
<a href= "#" class= "list-group-item list-group-item-action list-group-item-warning" > A simple warning list group item</a>
<a href= "#" class= "list-group-item list-group-item-action list-group-item-info" > A simple info list group item</a>
<a href= "#" class= "list-group-item list-group-item-action list-group-item-light" > A simple light list group item</a>
<a href= "#" class= "list-group-item list-group-item-action list-group-item-dark" > A simple dark list group item</a>
</div>
Kuendesa zvinoreva kunobatsira matekinoroji
Kushandisa ruvara kuwedzera zvinoreva kunongopa chiratidzo chekuona, icho chisingazopirwe kune vashandisi vetekinoroji yekubatsira - senge zvidzitiro zvekuverenga. Ita shuwa kuti ruzivo rwunoratidzwa neruvara rwuri pachena kubva pane zvirimo (semuzvinyorwa zvinooneka), kana kuti zvinosanganisirwa neimwe nzira, senge mamwe mavara akavigwa .sr-only
nekirasi.
Nemabheji
Wedzera mabheji kune chero chinyorwa cheboka chinhu kuratidza zvisingaverengeki kuverenga, chiitiko, uye nezvimwe nerubatsiro rwezvimwe zvinoshandiswa .
Cras justo odio14
Dapibus ac facilisis in2
Morbi leo risus1
Copy
<ul class= "list-group" >
<li class= "list-group-item d-flex justify-content-between align-items-center" >
Cras justo odio
<span class= "badge badge-primary badge-pill" > 14</span>
</li>
<li class= "list-group-item d-flex justify-content-between align-items-center" >
Dapibus ac facilisis in
<span class= "badge badge-primary badge-pill" > 2</span>
</li>
<li class= "list-group-item d-flex justify-content-between align-items-center" >
Morbi leo risus
<span class= "badge badge-primary badge-pill" > 1</span>
</li>
</ul>
Custom content
Wedzera ingangoita chero HTML mukati, kunyangwe yeakabatana rondedzero mapoka seari pazasi, nerubatsiro rweflexbox utilities .
Copy
<div class= "list-group" >
<a href= "#" class= "list-group-item list-group-item-action active" >
<div class= "d-flex w-100 justify-content-between" >
<h5 class= "mb-1" > List group item heading</h5>
<small> 3 days ago</small>
</div>
<p class= "mb-1" > Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
<small> Donec id elit non mi porta.</small>
</a>
<a href= "#" class= "list-group-item list-group-item-action" >
<div class= "d-flex w-100 justify-content-between" >
<h5 class= "mb-1" > List group item heading</h5>
<small class= "text-muted" > 3 days ago</small>
</div>
<p class= "mb-1" > Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
<small class= "text-muted" > Donec id elit non mi porta.</small>
</a>
<a href= "#" class= "list-group-item list-group-item-action" >
<div class= "d-flex w-100 justify-content-between" >
<h5 class= "mb-1" > List group item heading</h5>
<small class= "text-muted" > 3 days ago</small>
</div>
<p class= "mb-1" > Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
<small class= "text-muted" > Donec id elit non mi porta.</small>
</a>
</div>
JavaScript maitiro
Shandisa iyo tebhu JavaScript plugin-isanganise iyo yega kana kuburikidza neyakaunganidzwa bootstrap.js
faira-kuwedzera yedu runyorwa boka kuti ugadzire zvinobatika zvemukati zvemukati.
Velit aute mollit ipsum ad dolor consectetur nulla officia culpa adipisicing exercitation fugiat tempor. Voluptate deserunt sit sunt nisi aliqua fugiat proident ea ut. Mollit voluptate reprehenderit occaecat nisi ad non minim tempor sunt voluptate consectetur exercitation id ut nulla. Ea et fugiat aliquip nostrud sunt incididunt consectetur culpa aliquip eiusmod dolor. Anim ad Lorem aliqua in cupidatat nisi enim eu nostrud do aliquip veniam minim.
Cupidatat quis ad sint excepteur laborum in esse qui. Et excepteur consectetur ex nisi eu do cillum ad laborum. Mollit et eu officia dolore sunt Lorem culpa qui commodo velit ex amet id ex. Officia anim incididunt laboris deserunt anim aute dolor incididunt veniam aute dolore do exercitation. Dolor nisi culpa ex ad irure in elit eu dolore. Ad laboris ipsum reprehenderit irure non commodo enim culpa commodo veniam incididunt veniam ad.
Ut ut do pariatur aliquip aliqua aliquip exercitation do nostrud commodo reprehenderit aute ipsum voluptate. Irure Lorem et laboris nostrud amet cupidatat cupidatat anim do ut velit mollit consequat enim tempor. Consectetur est minim nostrud nostrud consectetur irure labore voluptate irure. Ipsum id Lorem sit sint voluptate est pariatur eu ad cupidatat et deserunt culpa sit eiusmod deserunt. Consectetur et fugiat anim do eiusmod aliquip nulla laborum elit adipisicing pariatur cillum.
Irure enim occaecat labore sit qui aliquip reprehenderit amet velit. Deserunt ullamco ex elit nostrud ut dolore nisi officia magna sit occaecat laboris sunt dolor. Nisi eu minim cillum occaecat aute est cupidatat aliqua labore aute occaecat ea aliquip sunt amet. Aute mollit dolor ut exercitation irure commodo non amet consectetur quis amet culpa. Quis ullamco nisi amet qui aute irure eu. Magna labore dolor quis ex labore id nostrud deserunt dolor eiusmod eu pariatur culpa mollit in irure.
Copy
<div class= "row" >
<div class= "col-4" >
<div class= "list-group" id= "list-tab" role= "tablist" >
<a class= "list-group-item list-group-item-action active" id= "list-home-list" data-toggle= "list" href= "#list-home" role= "tab" aria-controls= "home" > Home</a>
<a class= "list-group-item list-group-item-action" id= "list-profile-list" data-toggle= "list" href= "#list-profile" role= "tab" aria-controls= "profile" > Profile</a>
<a class= "list-group-item list-group-item-action" id= "list-messages-list" data-toggle= "list" href= "#list-messages" role= "tab" aria-controls= "messages" > Messages</a>
<a class= "list-group-item list-group-item-action" id= "list-settings-list" data-toggle= "list" href= "#list-settings" role= "tab" aria-controls= "settings" > Settings</a>
</div>
</div>
<div class= "col-8" >
<div class= "tab-content" id= "nav-tabContent" >
<div class= "tab-pane fade show active" id= "list-home" role= "tabpanel" aria-labelledby= "list-home-list" > ...</div>
<div class= "tab-pane fade" id= "list-profile" role= "tabpanel" aria-labelledby= "list-profile-list" > ...</div>
<div class= "tab-pane fade" id= "list-messages" role= "tabpanel" aria-labelledby= "list-messages-list" > ...</div>
<div class= "tab-pane fade" id= "list-settings" role= "tabpanel" aria-labelledby= "list-settings-list" > ...</div>
</div>
</div>
</div>
Kushandisa data hunhu
Unogona kumisikidza rondedzero yekufamba kweboka pasina kunyora chero JavaScript nekungotsanangura data-toggle="list"
kana pane chinhu. Shandisa idzi data attribution pa .list-group-item
.
Copy
<!-- List group -->
<div class= "list-group" id= "myList" role= "tablist" >
<a class= "list-group-item list-group-item-action active" data-toggle= "list" href= "#home" role= "tab" > Home</a>
<a class= "list-group-item list-group-item-action" data-toggle= "list" href= "#profile" role= "tab" > Profile</a>
<a class= "list-group-item list-group-item-action" data-toggle= "list" href= "#messages" role= "tab" > Messages</a>
<a class= "list-group-item list-group-item-action" data-toggle= "list" href= "#settings" role= "tab" > Settings</a>
</div>
<!-- Tab panes -->
<div class= "tab-content" >
<div class= "tab-pane active" id= "home" role= "tabpanel" > ...</div>
<div class= "tab-pane" id= "profile" role= "tabpanel" > ...</div>
<div class= "tab-pane" id= "messages" role= "tabpanel" > ...</div>
<div class= "tab-pane" id= "settings" role= "tabpanel" > ...</div>
</div>
Via JavaScript
Gonesa chinobatika chinyorwa chinhu kuburikidza neJavaScript (chimwe nechimwe chinyorwa chinoda kuvhurwa chega):
Copy
$ ( ' #myList a ' ). on ( ' click ' , function ( e ) {
e . preventDefault ()
$ ( this ). tab ( ' show ' )
})
Iwe unogona kumisa chinhu chega chega munzira dzinoverengeka:
Copy
$ ( ' #myList a[href="#profile"] ' ). tab ( ' show ' ) // Select tab by name
$ ( ' #myList a:first-child ' ). tab ( ' show ' ) // Select first tab
$ ( ' #myList a:last-child ' ). tab ( ' show ' ) // Select last tab
$ ( ' #myList a:nth-child(3) ' ). tab ( ' show ' ) // Select third tab
Fade effect
Kuita kuti ma tabs panel apere mukati, wedzera .fade
kune imwe neimwe .tab-pane
. Yekutanga tebhu pani inofanirawo .show
kuita kuti zvekutanga zvionekwe.
Copy
<div class= "tab-content" >
<div class= "tab-pane fade show active" id= "home" role= "tabpanel" > ...</div>
<div class= "tab-pane fade" id= "profile" role= "tabpanel" > ...</div>
<div class= "tab-pane fade" id= "messages" role= "tabpanel" > ...</div>
<div class= "tab-pane fade" id= "settings" role= "tabpanel" > ...</div>
</div>
Nzira
$().tab
Inomisikidza chinyorwa chechimwe chinhu uye mudziyo wemukati. Tab inofanirwa kunge iine data-target
kana href
yakanangana nemudziyo node muDOM.
Copy
<div class= "list-group" id= "myList" role= "tablist" >
<a class= "list-group-item list-group-item-action active" data-toggle= "list" href= "#home" role= "tab" > Home</a>
<a class= "list-group-item list-group-item-action" data-toggle= "list" href= "#profile" role= "tab" > Profile</a>
<a class= "list-group-item list-group-item-action" data-toggle= "list" href= "#messages" role= "tab" > Messages</a>
<a class= "list-group-item list-group-item-action" data-toggle= "list" href= "#settings" role= "tab" > Settings</a>
</div>
<div class= "tab-content" >
<div class= "tab-pane active" id= "home" role= "tabpanel" > ...</div>
<div class= "tab-pane" id= "profile" role= "tabpanel" > ...</div>
<div class= "tab-pane" id= "messages" role= "tabpanel" > ...</div>
<div class= "tab-pane" id= "settings" role= "tabpanel" > ...</div>
</div>
<script>
$ ( function () {
$ ( ' #myList a:last-child ' ). tab ( ' show ' )
})
</script>
.tab('show')
Inosarudza chinhu chakapihwa uye inoratidza chakabatana nacho. Chero chimwe chinhu chakambosarudzwa chinova chisina kusarudzwa uye pane chakabatana nacho chinovanzwa. Inodzokera kune anofona tebhu isati yanyatsoratidzwa (semuenzaniso, shown.bs.tab
chiitiko chisati chaitika).
Copy
$ ( ' #someListItem ' ). tab ( ' show ' )
Zviitiko
Kana uchiratidza tebhu nyowani, zviitiko zvinopisa nenzira inotevera:
hide.bs.tab
(pane ikozvino inoshanda tab)
show.bs.tab
(paicha-kuratidzwa tab)
hidden.bs.tab
(paiyo yapfuura inoshanda tebhu, yakafanana hide.bs.tab
neyechiitiko)
shown.bs.tab
(paiyo ichangobva-kushanda ichangoratidzwa tab, yakafanana show.bs.tab
neyechiitiko)
Kana pasina tab yanga yatoshanda, iyo hide.bs.tab
uye hidden.bs.tab
zviitiko hazvizodzingwa.
Chiitiko mhando
Tsanangudzo
show.bs.tab
Ichi chiitiko chinopisa pane tab show, asi iyo itsva tebhu isati yaratidzwa. Shandisa event.target
uye event.relatedTarget
kunanga iyo inoshanda tebhu uye yapfuura inoshanda tebhu (kana iripo) zvichiteerana.
display.bs.tab
Ichi chiitiko chinopisa pane tab show mushure mekunge tab yaratidzwa. Shandisa event.target
uye event.relatedTarget
kunanga iyo inoshanda tebhu uye yapfuura inoshanda tebhu (kana iripo) zvichiteerana.
hide.bs.tab
Ichi chiitiko chinopisa kana tabhu nyowani icharatidzwa (uye nekudaro iyo yapfuura inoshanda tebhu inofanira kuvanzwa). Shandisa event.target
uye event.relatedTarget
kunanga yazvino inoshanda tebhu uye iyo nyowani-ichaita-inoshanda tebhu, zvichiteerana.
zvakavanzika.bs.tab
Ichi chiitiko chinopisa mushure mekunge tabhu nyowani yaratidzwa (uye nekudaro iyo yapfuura inoshanda tebhu yakavanzwa). Shandisa event.target
uye event.relatedTarget
kunanga iyo yapfuura inoshanda tebhu uye iyo itsva inoshanda tebhu, zvichiteerana.
Copy
$ ( ' a[data-toggle="list"] ' ). on ( ' shown.bs.tab ' , function ( e ) {
e . target // newly activated tab
e . relatedTarget // previous active tab
})