SourceAndika itsinda
Amatsinda y'urutonde ni ibintu byoroshye kandi bikomeye byo kwerekana urukurikirane rw'ibirimo. Hindura kandi ubagure kugirango bashyigikire hafi y'ibirimo byose imbere.
Urugero rwibanze
Urutonde rwibanze rwitsinda ni urutonde rudafite urutonde rwibintu hamwe nibyiciro bikwiye. Wiyubakire hamwe namahitamo akurikira, cyangwa hamwe na CSS yawe nkuko bikenewe.
Cras justo odio
Dapibus ac facilisis muri
Morbi leo risus
Porta ac consectetur ac
Vestibulum kuri eros
Gukoporora
<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>
Ibintu bifatika
Ongeraho .active
a .list-group-item
kugirango werekane ibyatoranijwe bikora.
Cras justo odio
Dapibus ac facilisis muri
Morbi leo risus
Porta ac consectetur ac
Vestibulum kuri eros
Gukoporora
<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>
Ibintu byahagaritswe
Ongeraho .disabled
kuri a .list-group-item
kugirango bigaragare ko byahagaritswe. Menya ko ibintu bimwe na bimwe .disabled
bizakenera JavaScript yihariye kugirango ihagarike byimazeyo ibyabaye (urugero, amahuza).
Cras justo odio
Dapibus ac facilisis muri
Morbi leo risus
Porta ac consectetur ac
Vestibulum kuri eros
Gukoporora
<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>
Koresha <a>
s cyangwa <button>
s kugirango ukore urutonde rwibikorwa byitsinda ryibintu hamwe na hover, byahagaritswe, hamwe na leta ikora wongeyeho .list-group-item-action
. Dutandukanya aya masomo ya pseudo kugirango tumenye amatsinda yakozwe kurutonde rwibintu bidakorana (nka <li>
s cyangwa <div>
s) bidatanga gukanda cyangwa gukanda.
Witondere kudakoresha .btn
amasomo asanzwe hano .
Gukoporora
<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>
Hamwe na <button>
s, urashobora kandi gukoresha disabled
ikiranga aho kuba .disabled
icyiciro. Birababaje, <a>
ntabwo ushyigikiye ikiranga.
Cras justo odio
Dapibus ac facilisis muri
Morbi leo risus
Porta ac consectetur ac
Vestibulum kuri eros
Gukoporora
<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>
Fasha
Ongeraho .list-group-flush
kugirango ukureho imipaka hamwe nu mfuruka zizengurutse kugirango utange urutonde rwibintu byitsinda kugeza ku kintu cyababyeyi (urugero, amakarita).
Cras justo odio
Dapibus ac facilisis muri
Morbi leo risus
Porta ac consectetur ac
Vestibulum kuri eros
Gukoporora
<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>
Amasomo ajyanye
Koresha amasomo ajyanye nuburyo bwo gutondekanya urutonde hamwe na leta hamwe nibara.
Dapibus ac facilisis muri
Urutonde rwibanze rwibanze rwitsinda
Urutonde rworoheje rwa kabiri urutonde rwitsinda
Intsinzi yoroshye kurutonde rwitsinda
Urutonde rworoshye urutonde rwibintu
Urutonde rworoshye rwo kuburira urutonde rwitsinda
Ibisobanuro byoroshye urutonde rwitsinda
Urutonde rworoheje urutonde rwibintu
Urutonde rworoshye rwurutonde rwitsinda
Gukoporora
<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>
Amasomo ajyanye nayo akorana nayo .list-group-item-action
. Reba inyongera yuburyo bwa hover hano ntabwo igaragara murugero rwabanje. Inkunga nayo ni .active
leta; shyira mu bikorwa kugirango ugaragaze ihitamo rikorwa kurutonde rwibintu.
Gukoporora
<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>
Gutanga ibisobanuro kubuhanga bufasha
Gukoresha ibara kugirango wongere ibisobanuro bitanga gusa icyerekezo cyerekana, kitazashyikirizwa abakoresha tekinoroji ifasha - nk'abasoma ecran. Menya neza ko amakuru yerekanwe n'ibara agaragara uhereye kubirimo ubwabyo (urugero: inyandiko igaragara), cyangwa bigashyirwa muburyo butandukanye, nk'inyandiko y'inyongera ihishe hamwe .sr-only
n'ishuri.
N'ibirango
Ongeraho badge kurutonde urwo arirwo rwose kugirango werekane ibara ridasomwe, ibikorwa, nibindi byinshi bifashishije ibikorwa bimwe na bimwe byingirakamaro .
Cras justo odio14
Dapibus ac facilisis muri2
Morbi leo risus1
Gukoporora
<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>
Ibirimo
Ongeramo hafi HTML iyo ari yo yose, ndetse no kumurwi uhuza urutonde nkurwo hepfo, hamwe nubufasha bwa flexbox .
Gukoporora
<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>
Imyitwarire ya JavaScript
Koresha tab JavaScript plugin-shyiramo kugiti cyawe cyangwa unyuze muri bootstrap.js
dosiye yakusanyijwe - kugirango wongere itsinda ryurutonde kugirango ukore imbonerahamwe yibirimo yibirimo.
Velit aute mollit ipsum ad dolor consectetur nulla officia culpa adipisising imyitozo ya fugiat igihe gito. Voluptate deserunt icara sunt nisi aliqua fugiat proident ea ut. Mollit voluptate reprehenderit occaecat nisi ad non minim tempor sunt voluptate consectetur imyitozo id ut nulla. Ea et fugiat aliquip nostrud sunt incididunt consectetur culpa aliquip eiusmod dolor. Anim ad Lorem aliqua muri 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.
Gukoporora
<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>
Koresha ibiranga amakuru
Urashobora gukora urutonde rwitsinda ryanditse utanditse JavaScript iyo ari yo yose ugaragaza data-toggle="list"
cyangwa ku kintu. Koresha aya makuru ibiranga kuri .list-group-item
.
Gukoporora
<!-- 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>
Binyuze kuri JavaScript
Gushoboza urutonde rwibintu ukoresheje JavaScript (buri kintu cyurutonde kigomba gukoreshwa kugiti cye):
Gukoporora
$ ( '#myList a' ). on ( 'click' , function ( e ) {
e . preventDefault ()
$ ( this ). tab ( 'show' )
})
Urashobora gukora urutonde rwumuntu muburyo butandukanye:
Gukoporora
$ ( '#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
Ingaruka zashize
Kugirango utume pansiyo ishire, ongera .fade
kuri buri .tab-pane
. Urupapuro rwa mbere rwa pane rugomba kandi .show
gukora ibintu byambere bigaragara.
Gukoporora
<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>
Uburyo
$ (). tab
Gukora urutonde rwibintu nibintu birimo. Tab igomba kuba ifite a data-target
cyangwa href
igamije icyerekezo cya kontineri muri DOM.
Gukoporora
<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 ('kwerekana')
Hitamo urutonde rwatanzwe kandi rwerekane pane. Ibindi bintu byose byurutonde byari byatoranijwe mbere biba bitatoranijwe kandi pane bifitanye isano irahishe. Garuka kumuhamagara mbere yuko tab pane yerekanwe mubyukuri (urugero, mbere yuko shown.bs.tab
ibyabaye bibaho).
Gukoporora
$ ( '#someListItem' ). tab ( 'show' )
Ibyabaye
Iyo werekanye tab nshya, ibyabaye birashya muburyo bukurikira:
hide.bs.tab
(kuri tab ikora)
show.bs.tab
(kuri to-kwerekanwa tab)
hidden.bs.tab
(kurupapuro rwibanze rukora, kimwe hide.bs.tab
nkicyabaye)
shown.bs.tab
(ku gishya-gikora gusa-cyerekanwe tab, kimwe kimwe show.bs.tab
nicyabaye)
Niba nta tab yari isanzwe ikora, hide.bs.tab
ibyabaye hidden.bs.tab
ntibizasezererwa.
Ubwoko bwibyabaye
Ibisobanuro
kwerekana.bs.tab
Ibirori birasa kuri tab yerekana, ariko mbere yuko tab nshya yerekanwe. Koresha event.target
no event.relatedTarget
gutondekanya tab ikora hamwe na tab yabanjirije gukora (niba ihari).
yerekanwe.bs.tab
Ibirori birasa kuri tab yerekanwe nyuma ya tab yerekanwe. Koresha event.target
no event.relatedTarget
gutondekanya tab ikora hamwe na tab yabanjirije gukora (niba ihari).
guhisha.bs.tab
Ibirori birasa iyo tab nshya igomba kwerekanwa (nuko rero tab ikora ibanza igomba guhishwa). Koresha event.target
no event.relatedTarget
kugenera icyerekezo gikora hamwe nigishya vuba-kugirango-gikore, kimwe.
bihishe.bs.tab
Ibirori birashya nyuma ya tab nshya yerekanwe (nuko rero tab yabanjirije gukora irahishe). Koresha event.target
no event.relatedTarget
guhitamo intego yabanjirije gukora hamwe na tab nshya ikora, uko bikurikirana.
Gukoporora
$ ( 'a[data-toggle="list"]' ). on ( 'shown.bs.tab' , function ( e ) {
e . target // newly activated tab
e . relatedTarget // previous active tab
})