in English

Iqembu lohlu

Amaqembu ohlu ayingxenye eguqukayo nenamandla yokubonisa uchungechunge lokuqukethwe. Ziguqule futhi uzinwebe ukuze zisekele cishe noma yikuphi okuqukethwe ngaphakathi.

Isibonelo esiyisisekelo

Iqembu lohlu oluyisisekelo wuhlu olunga-odwe olunezinto zohlu kanye namakilasi afanele. Yakhela phezu kwayo ngezinketho ezilandelayo, noma nge-CSS yakho njengoba kudingeka.

  • Cras justo odio
  • I-Dapibus ac facilisis in
  • I-Morbi leo rius
  • I-Porta ac consectetur ac
  • I-Vestibulum ne-eros
<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

Engeza .activeku-a .list-group-itemukukhombisa ukukhetha okusebenzayo kwamanje.

  • Cras justo odio
  • I-Dapibus ac facilisis in
  • I-Morbi leo rius
  • I-Porta ac consectetur ac
  • I-Vestibulum ne-eros
<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 ezikhutshaziwe

Engeza .disabledku-a .list-group-itemukuze ukwenze kubonakale kuvaliwe. Qaphela ukuthi ezinye izinto ezinazo .disabledzizodinga i-JavaScript yangokwezifiso ukukhubaza ngokugcwele imicimbi yazo yokuchofoza (isb, izixhumanisi).

  • Cras justo odio
  • I-Dapibus ac facilisis in
  • I-Morbi leo rius
  • I-Porta ac consectetur ac
  • I-Vestibulum ne-eros
<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 u <a>-s noma <button>u-s ukuze udale izinto zeqembu ezisebenzisekayo ezinezimo ezihambisa phezulu, ezikhutshaziwe, nezisebenzayo ngokwengeza okuthi .list-group-item-action. Sihlukanisa lezi zigaba-mbumbulu ukuze siqinisekise ukuthi amaqembu ohlu enziwe ngezinto ezingasebenzisani (njengama- <li>s noma <div>s) awanikezi ngokuchofoza noma ukuthepha ukukhokhela.

Qiniseka ukuthi awusebenzisi .btnamakilasi ajwayelekile lapha .

<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, ungakwazi futhi ukusebenzisa disabledisibaluli esikhundleni .disabledsekilasi. Ngokudabukisayo, i- <a>s ayisekeli isici sokukhubazeka.

<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

Engeza .list-group-flushukuze ususe eminye imingcele namakhona ayindilinga ukuze unikeze uhlu lwezinto zeqembu emaphethelweni esiqukathi esingumzali (isb, amakhadi).

  • Cras justo odio
  • I-Dapibus ac facilisis in
  • I-Morbi leo rius
  • I-Porta ac consectetur ac
  • I-Vestibulum ne-eros
<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>

Evundlile

Engeza .list-group-horizontalukuze ushintshe ukwakheka kwezinto zeqembu zohlu ukusuka kokuqondile kuye kokuvundlile kuwo wonke ama-breakpoint. Noma, khetha okuhlukile okusabelayo .list-group-horizontal-{sm|md|lg|xl}ukuze wenze iqembu lohlu livundlile liqala kuleyo breakpoint's min-width. Okwamanje amaqembu ohlu oluvundlile awakwazi ukuhlanganiswa namaqembu ohlu lwe-flush.

I-ProTip: Ufuna izinto zeqembu ezinobubanzi obulinganayo uma uvundlile? Engeza .flex-fillentweni ngayinye yohlu yohlu.

  • Cras justo odio
  • I-Dapibus ac facilisis in
  • I-Morbi leo rius
<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
  • I-Dapibus ac facilisis in
  • I-Morbi leo rius
<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
  • I-Dapibus ac facilisis in
  • I-Morbi leo rius
<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
  • I-Dapibus ac facilisis in
  • I-Morbi leo rius
<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
  • I-Dapibus ac facilisis in
  • I-Morbi leo rius
<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>

Amakilasi omongo

Sebenzisa amakilasi anomongo ukwenza izinto zohlu lwesitayela ezinengemuva elihle nombala.

  • I-Dapibus ac facilisis in
  • Into yeqembu elula eyinhloko
  • Into yeqembu yohlu lwesibili olula
  • Into yeqembu elula yohlu lwempumelelo
  • Into yeqembu elula yohlu lwengozi
  • Into yeqembu elula yohlu lwesixwayiso
  • Into yeqembu yolwazi olula
  • Into yeqembu elula yohlu olukhanyayo
  • Into yeqembu elula yohlu olumnyama
<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>

Amakilasi omongo nawo asebenza .list-group-item-action. Qaphela ukungezwa kwezitayela zokuhambisa phezulu lapha akukho esibonelweni sangaphambilini. Okunye okusekelwa .activeumbuso; sebenzisa ukuze ubonise okukhethiwe okusebenzayo entweni yohlu lokuqukethwe.

<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>
Ukudlulisa incazelo kubuchwepheshe obusizayo

Ukusebenzisa umbala ukwengeza incazelo kunikeza kuphela inkomba ebonakalayo, engeke idluliselwe kubasebenzisi bobuchwepheshe obusizayo - njengezifundi zesikrini. Qinisekisa ukuthi ulwazi olushiwo umbala lusobala kokuqukethwe ngokwako (isb umbhalo obonakalayo), noma lufakwe ngezinye izindlela, njengombhalo owengeziwe ofihliwe .sr-onlynekilasi.

Ngamabheji

Engeza amabheji kunoma iyiphi into yeqembu lohlu ukuze ubonise izibalo ezingafundiwe, umsebenzi, nokunye ngosizo lwezinye izinsiza .

  • Cras justo odio14
  • I-Dapibus ac facilisis in2
  • I-Morbi leo rius1
<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>

Okuqukethwe ngokwezifiso

Engeza cishe noma iyiphi i-HTML ngaphakathi, ngisho nasemaqenjini ohlu axhumene njengaleli elingezansi, ngosizo lwezinsiza ze- flexbox .

<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 yethebhu ye-JavaScript—ifake ngayodwa noma bootstrap.jsngefayela elihlanganisiwe—ukuze unwebe iqembu lethu lohlu ukuze udale amafasitelana angamathebhu okuqukethwe kwasendaweni.

<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 izibaluli zedatha

Ungakwazi ukwenza kusebenze ukuzulazula kweqembu lohlu ngaphandle kokubhala noma iyiphi i-JavaScript ngokucacisa data-toggle="list"noma ngento ethile. Sebenzisa lezi zibaluli zedatha ku- .list-group-item.

<!-- 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>

Nge-JavaScript

Nika amandla into yohlu lwethebhu nge-JavaScript (into ngayinye yohlu idinga ukwenziwa isebenze ngayodwana):

$('#myList a').on('click', function (e) {
  e.preventDefault()
  $(this).tab('show')
})

Ungakwazi ukwenza kusebenze into ngayinye yohlu ngezindlela ezimbalwa:

$('#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 umphumela

Ukuze wenze iphaneli yamathebhu ifiphale, .fadeengeza .tab-pane. Ifasitelana lethebhu yokuqala kufanele futhi .showlenze okuqukethwe kokuqala kubonakale.

<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>

Izindlela

$().ithebhu

Yenza kusebenze into yohlu nesiqukathi sokuqukethwe. Ithebhu kufanele ibe no-a data-targetnoma i href-container node ku-DOM.

<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>

.ithebhu('bonisa')

Selects the given list item and shows its associated pane. Any other list item that was previously selected becomes unselected and its associated pane is hidden. Returns to the caller before the tab pane has actually been shown (for example, before the shown.bs.tab event occurs).

$('#someListItem').tab('show')

Events

When showing a new tab, the events fire in the following order:

  1. hide.bs.tab (on the current active tab)
  2. show.bs.tab (on the to-be-shown tab)
  3. hidden.bs.tab (on the previous active tab, the same one as for the hide.bs.tab event)
  4. shown.bs.tab (on the newly-active just-shown tab, the same one as for the show.bs.tab event)

If no tab was already active, the hide.bs.tab and hidden.bs.tab events will not be fired.

Event type Description
show.bs.tab This event fires on tab show, but before the new tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
shown.bs.tab This event fires on tab show after a tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
hide.bs.tab This event fires when a new tab is to be shown (and thus the previous active tab is to be hidden). Use event.target and event.relatedTarget to target the current active tab and the new soon-to-be-active tab, respectively.
hidden.bs.tab This event fires after a new tab is shown (and thus the previous active tab is hidden). Use event.target and event.relatedTarget to target the previous active tab and the new active tab, respectively.
$('a[data-toggle="list"]').on('shown.bs.tab', function (e) {
  e.target // newly activated tab
  e.relatedTarget // previous active tab
})