SourceUluhlu lweqela
Amaqela oluhlu ayinxalenye eguquguqukayo kwaye enamandla yokubonisa uluhlu lomxholo. Guqula kwaye uyandise ukuxhasa malunga nawo nawuphi na umxholo ongaphakathi.
Umzekelo osisiseko
Elona qela loluhlu olusisiseko luluhlu olungacwangciswanga olunezinto zoluhlu kunye neeklasi ezifanelekileyo. Yakha phezu kwayo ngeenketho ezilandelayo, okanye ngeyakho iCSS njengoko kufuneka.
Cras justo odio
Dapibus ac facilisis in
UMorbi namhlanje
Porta ac consectetur ac
Vestibulum kunye eros
Khuphela
<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>
Izinto ezisebenzayo
Yongeza .active
kwi- .list-group-item
a ukubonisa ukhetho olusebenzayo lwangoku.
Cras justo odio
Dapibus ac facilisis in
UMorbi namhlanje
Porta ac consectetur ac
Vestibulum kunye eros
Khuphela
<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>
Izinto ezikhubazekileyo
Yongeza .disabled
ku-a .list-group-item
ukuze ibonakale ivaliwe. Qaphela ukuba ezinye izinto kunye .disabled
nazo ziyakufuna iJavaScript yesiko ukuvala imisitho yokucofa ngokupheleleyo (umzekelo, amakhonkco).
Cras justo odio
Dapibus ac facilisis in
UMorbi namhlanje
Porta ac consectetur ac
Vestibulum kunye eros
Khuphela
<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>
Sebenzisa i- <a>
s okanye <button>
i-s ukwenza uluhlu lwezinto ezisebenzayo zeqela nge-hover, ivaliwe, kunye neemeko ezisebenzayo ngokudibanisa .list-group-item-action
. Sahlula ezi klasi pseudo-ukuqinisekisa uluhlu lwamaqela ezenziwe non-interactive element (ezifana <li>
s okanye <div>
s) ababoneleli ngonqakrazo okanye ucofe ukufikelela.
Qinisekisa ukuba ungasebenzisi .btn
iiklasi eziqhelekileyo apha .
Khuphela
<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>
Nge <button>
s, ungenza kwakhona ukusebenzisa disabled
uphawu endaweni .disabled
yeklasi. Okulusizi kukuba, <a>
abaluxhasi uphawu lokukhubazeka.
Cras justo odio
Dapibus ac facilisis in
UMorbi namhlanje
Porta ac consectetur ac
Vestibulum kunye eros
Khuphela
<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>
Gubha
Yongeza .list-group-flush
ukususa imida ethile kunye neekona ezingqukuva ukunika uluhlu lwezinto zeqela edge-to-edge kwisikhongozeli esingumzali (umzekelo, amakhadi).
Cras justo odio
Dapibus ac facilisis in
UMorbi namhlanje
Porta ac consectetur ac
Vestibulum kunye eros
Khuphela
<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>
Ukuthe tye
Yongeza .list-group-horizontal
ukutshintsha uyilo loluhlu lwezinto zeqela ukusuka ngokuthe nkqo ukuya ngokuthe tye kuzo zonke iindawo zokuqhawula. Kungenjalo, khetha ulwahlulo oluphendulayo .list-group-horizontal-{sm|md|lg|xl}
ukwenza uluhlu lweqela elithe tyaba liqala kwelo breakpoint min-width
. Okwangoku amaqela oluhlu oluthe tye akanakudityaniswa namaqela oluhlu lokugungxula.
I-ProTip: Ufuna izinto zeqela ezinobubanzi obulinganayo xa zithe tye? Yongeza .flex-fill
kuluhlu ngalunye into yeqela.
Cras justo odio
Dapibus ac facilisis in
UMorbi namhlanje
Khuphela
<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
UMorbi namhlanje
Khuphela
<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
UMorbi namhlanje
Khuphela
<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
UMorbi namhlanje
Khuphela
<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
UMorbi namhlanje
Khuphela
<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>
Iiklasi zomxholo
Sebenzisa iiklasi zomxholo ukwenza uluhlu lwezinto ezinemvelaphi kunye nombala obalaseleyo.
Dapibus ac facilisis in
Uluhlu olulula olungundoqo lwento yeqela
Into elula yoluhlu lwesibini lweqela
Inqaku leqela lempumelelo elilula
Uluhlu olulula lwezinto ezinobungozi kwiqela
Uluhlu olulula loluhlu lwezinto zeqela
Uluhlu lolwazi olulula into yeqela
Uluhlu olulula loluhlu into yeqela
Into yeqela elilula elimnyama
Khuphela
<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>
Iiklasi zomxholo nazo zisebenza kunye .list-group-item-action
. Qaphela ukongezwa kwezitayile ze-hover apha azikho kumzekelo wangaphambili. Ikwaxhaswa .active
ngurhulumente; yifake ukubonisa ukhetho olusebenzayo kuluhlu lomxholo wento yeqela.
Khuphela
<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>
Ukuhambisa intsingiselo kwiiteknoloji ezincedisayo
Ukusebenzisa umbala ukongeza intsingiselo kubonelela kuphela ngesalathiso esibonakalayo, esingayi kuthunyelwa kubasebenzisi betekhnoloji encedisayo - njengezifundi zesikrini. Qinisekisa ukuba ulwazi olubonakaliswe ngumbala lucacile kumxholo ngokwawo (umzekelo, umbhalo obonakalayo), okanye luqukwe ngezinye iindlela, ezifana nesicatshulwa esongezelelweyo esifihlwe .sr-only
eklasini.
Neebheji
Yongeza iibheji kuyo nayiphi na into yeqela loluhlu ukubonisa amanani angafundwanga, umsebenzi, kunye nokunye ngoncedo lwezinye izinto eziluncedo .
Cras justo odio14
Dapibus ac facilisis in2
UMorbi namhlanje1
Khuphela
<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>
Umxholo oqhelekileyo
Yongeza phantse nayiphi na i-HTML ngaphakathi, nakuluhlu lwamaqela adityanisiweyo afana neli lingezantsi, ngoncedo lwezinto eziluncedo ze- flexbox .
Khuphela
<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>
Ukuziphatha kweJavaScript
Sebenzisa i-plugin ye-JavaScript yethebhu-yibandakanye ngabanye okanye ngefayile ehlanganisiweyo bootstrap.js
-ukwandisa iqela lethu loluhlu ukwenza iipaneli ze-tableable zomxholo wendawo.
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. 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.
Khuphela
<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>
Ukusebenzisa iimpawu zedatha
Unokwenza ukhangelo lweqela loluhlu ngaphandle kokubhala nasiphi na iJavaScript ngokuchaza ngokulula data-toggle="list"
okanye kwinto. Sebenzisa ezi mpawu zedatha kwi .list-group-item
.
Khuphela
<!-- 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>
NgeJavaScript
Yenza umba woluhlu olunokubakho ngeJavaScript (uluhlu ngalunye kufuneka luvulwe ngokwalo):
Khuphela
$ ( ' #myList a ' ). on ( ' click ' , function ( e ) {
e . preventDefault ()
$ ( this ). tab ( ' show ' )
})
Unokwenza uluhlu ngalunye lusebenze ngeendlela ezininzi:
Khuphela
$ ( ' #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 isiphumo
Ukwenza indawo yolawulo yeethebhu iphelelwe, yongeza .fade
kuyo nganye .tab-pane
. Ipheyini yethebhu yokuqala kufuneka kwakhona .show
yenze umxholo wokuqala ubonakale.
Khuphela
<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>
Iindlela
$().tab
Yenza kusebenze into yoluhlu kunye nesiqulatho somxholo. Isithuba kufuneka sibenendawo data-target
okanye indawo href
yesikhongozeli kwiDOM.
Khuphela
<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('bonisa')
Ikhetha umba woluhlu olunikiweyo kwaye ibonise isahlulo sayo esinxulumeneyo. Nayiphi na enye into yoluhlu ebikhe yakhethwa ngaphambili ayikhethwanga kwaye isahlulo sayo esinxulumeneyo siyafihlwa. Ibuyisela kumnxebi phambi kokuba ipayini yethebhu iboniswe ngokwenene (umzekelo, phambi kokuba shown.bs.tab
isiganeko senzeke).
Khuphela
$ ( ' #someListItem ' ). tab ( ' show ' )
Iziganeko
Xa ubonisa ithebhu entsha, iziganeko zivutha ngolu hlobo lulandelayo:
hide.bs.tab
(kwithebhu esebenzayo yangoku)
show.bs.tab
(kwi-eza kuboniswa thebhu)
hidden.bs.tab
(kwithebhu esebenzayo yangaphambili, efanayo nale hide.bs.tab
yesiganeko)
shown.bs.tab
(kwisithuba esandula ukusebenza esivele sibonise ithebhu, efanayo show.bs.tab
nesesiganeko)
Ukuba akukho thebhu ibisele iyasebenza, i hide.bs.tab
kunye hidden.bs.tab
neziganeko aziyi kugxothwa.
Uhlobo lomsitho
Inkcazo
bonisa.bs.tab
Esi siganeko sivutha kumboniso wethebhu, kodwa ngaphambi kokuba ithebhu entsha iboniswe. Sebenzisa event.target
kunye event.relatedTarget
nokujolisa isithuba esisebenzayo kunye nesithuba sangaphambili esisebenzayo (ukuba sikhona) ngokulandelelanayo.
ebonisiweyo.bs.tab
Esi siganeko sitshisa kwi-tab show emva kokuba ithebhu ibonisiwe. Sebenzisa event.target
kunye event.relatedTarget
nokujolisa isithuba esisebenzayo kunye nesithuba sangaphambili esisebenzayo (ukuba sikhona) ngokulandelelanayo.
fihla.bs.tab
Esi siganeko sitshisa xa isithuba esitsha siza kuboniswa (kwaye ke isithuba sangaphambili esisebenzayo siza kufihlwa). Sebenzisa event.target
kunye event.relatedTarget
nokujolisa ithebhu esebenzayo yangoku kunye nethebhu entsha eza kusebenza ngokukhawuleza, ngokulandelelanayo.
efihliweyo.bs.tab
Esi siganeko sivutha emva kokuba ithebhu entsha ibonisiwe (kwaye ke isithuba sangaphambili esisebenzayo sifihliwe). Sebenzisa event.target
kunye event.relatedTarget
nokujolisa kwithebhu esebenzayo yangaphambili kunye nethebhu entsha esebenzayo, ngokulandelelanayo.
Khuphela
$ ( ' a[data-toggle="list"] ' ). on ( ' shown.bs.tab ' , function ( e ) {
e . target // newly activated tab
e . relatedTarget // previous active tab
})