Lenaneo sehlopha
Dihlopha tša lenaneo ke karolo ye e fetofetogago le maemo le ye maatla ya go bontšha lelokelelo la diteng. Fetoša le go di katološa go thekga mo e ka bago diteng le ge e le dife ka gare.
Mohlala wa motheo
Sehlopha sa lenaneo la motheo kudu ke lenaneo leo le sa rulaganywago leo le nago le dilo tša lenaneo le diklase tša maleba. Aga godimo ga yona ka dikgetho tše di latelago, goba ka CSS ya gago ge go nyakega.
- Ntho e nngwe
- Selo sa bobedi
- Selo sa boraro
- Ntlha ya bone
- Le ya bohlano
<ul class="list-group">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
<li class="list-group-item">A fourth item</li>
<li class="list-group-item">And a fifth one</li>
</ul>
Dilo tše di šomago
Oketša .active
go a .list-group-item
go laetša kgetho ya bjale ye e šomago.
- Selo se se šomago
- Selo sa bobedi
- Selo sa boraro
- Ntlha ya bone
- Le ya bohlano
<ul class="list-group">
<li class="list-group-item active" aria-current="true">An active item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
<li class="list-group-item">A fourth item</li>
<li class="list-group-item">And a fifth one</li>
</ul>
Dilo tše di golofetšego
Oketša .disabled
go a .list-group-item
go dira gore e bonagale e golofetše. Hlokomela gore dielemente tše dingwe tše di nago le di .disabled
tla nyaka gape JavaScript ya tlwaelo go šitiša ka botlalo ditiragalo tša tšona tša go klika (mohlala, dikgokagano).
- Selo seo se golofetšego
- Selo sa bobedi
- Selo sa boraro
- Ntlha ya bone
- Le ya bohlano
<ul class="list-group">
<li class="list-group-item disabled" aria-disabled="true">A disabled item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
<li class="list-group-item">A fourth item</li>
<li class="list-group-item">And a fifth one</li>
</ul>
Dikgokagano le dikonope
Šomiša <a>
s goba <button>
s go hlama diaetheme tša sehlopha sa lenaneo tše di ka tšewago kgato.list-group-item-action
ka go hover, go golofala, le maemo a go šoma ka go tlaleletša . Re aroganya diklase tše tša maaka go netefatša gore dihlopha tša lenaneo tšeo di dirilwego ka dielemente tšeo di sa dirišanego (go swana le <li>
s goba <div>
s) ga di neelane ka go kgona go kgotla goba go kgotla.
Kgonthiša gore ga o šomiše .btn
diklase tša maemo mo .
<div class="list-group">
<a href="#" class="list-group-item list-group-item-action active" aria-current="true">
The current link item
</a>
<a href="#" class="list-group-item list-group-item-action">A second link item</a>
<a href="#" class="list-group-item list-group-item-action">A third link item</a>
<a href="#" class="list-group-item list-group-item-action">A fourth link item</a>
<a class="list-group-item list-group-item-action disabled">A disabled link item</a>
</div>
Ka <button>
s, o ka dira gape tšhomišo ya disabled
seka go e na le .disabled
sehlopha. Ka manyami, <a>
s ga e thekge seka se se golofetšego.
<div class="list-group">
<button type="button" class="list-group-item list-group-item-action active" aria-current="true">
The current button
</button>
<button type="button" class="list-group-item list-group-item-action">A second item</button>
<button type="button" class="list-group-item list-group-item-action">A third button item</button>
<button type="button" class="list-group-item list-group-item-action">A fourth button item</button>
<button type="button" class="list-group-item list-group-item-action" disabled>A disabled button item</button>
</div>
Hlatswa
Oketša .list-group-flush
go tloša mellwane ye mengwe le dikhutlo tša nkgokolo go tšweletša lenaneo la sehlopha diaetheme mošito go ya mošito ka gare ga setshelo sa motswadi (mohlala, dikarata).
- Ntho e nngwe
- Selo sa bobedi
- Selo sa boraro
- Ntlha ya bone
- Le ya bohlano
<ul class="list-group list-group-flush">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
<li class="list-group-item">A fourth item</li>
<li class="list-group-item">And a fifth one</li>
</ul>
Rapamego
Oketša .list-group-horizontal
go fetoša peakanyo ya diaetheme tša sehlopha sa lenaneo go tšwa go go ema go ya go go rapalala go putla dintlha ka moka tša go kgaotša. Ka go fapana le moo, kgetha mohuta wa go arabela .list-group-horizontal-{sm|md|lg|xl}
go dira gore sehlopha sa lenaneo se rapaletše go thoma ka ntlha yeo ya go kgaotša ya min-width
. Ga bjale dihlopha tša lenaneo tše di rapaletšego di ka se kopanywe le dihlopha tša lenaneo la go hlatswa.
ProTip: O nyaka dilo tša sehlopha sa lenaneo la bophara bjo bo lekanago ge di rapaletše? Oketša .flex-fill
go selo se sengwe le se sengwe sa sehlopha sa lenaneo.
- Ntho e nngwe
- Selo sa bobedi
- Selo sa boraro
- Ntho e nngwe
- Selo sa bobedi
- Selo sa boraro
- Ntho e nngwe
- Selo sa bobedi
- Selo sa boraro
- Ntho e nngwe
- Selo sa bobedi
- Selo sa boraro
- Ntho e nngwe
- Selo sa bobedi
- Selo sa boraro
<ul class="list-group list-group-horizontal">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-sm">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-md">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-lg">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-xl">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
Diklase tša diteng
Šomiša diklase tša diteng go lokeletša diaetheme tša setaele ka morago le mmala wa seemo.
- Ntho e bonolo ya sehlopha sa lenaneo la maitirelo
- Ntlha ya sehlopha sa lenaneo la mathomo se bonolo
- Ntlha ya sehlopha sa lenaneo la bobedi le bonolo
- Ntho e bonolo ya sehlopha sa lenaneo la katlego
- Ntho e bonolo ya sehlopha sa lenaneo la kotsi
- Ntlha ya sehlopha sa lenaneo la temošo ye bonolo
- A bonolo info lenaneo sehlopha ntho
- Ntho e bonolo ya sehlopha sa lenaneo la seetša
- Ntho e bonolo ya sehlopha sa lenaneo le lefifi
<ul class="list-group">
<li class="list-group-item">A simple default list group item</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>
Diklase tša seemo le tšona di šoma ka .list-group-item-action
. Hlokomela tlaleletšo ya mekgwa ya go hover mo e sego gona mohlaleng wa go feta. Gape go thekgwa ke .active
mmušo; e diriše go laetša kgetho ye e šomago godimo ga aetheme ya sehlopha sa lenaneo la diteng.
<div class="list-group">
<a href="#" class="list-group-item list-group-item-action">A simple default list group item</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>
Go fetišetša tlhalošo go theknolotši ya go thuša
Go šomiša mmala go oketša tlhalošo go fa fela taetšo ya go bonwa, yeo e ka se fetišwego go badiriši ba theknolotši ya go thuša – go swana le babadi ba skrine. Netefatša gore tshedimošo yeo e bontšhitšwego ka mmala e ka ba e bonagala gabotse go tšwa diteng ka botšona (mohlala, sengwalwa se se bonagalago), goba e akaretšwa ka mekgwa ye mengwe, go swana le sengwalwa sa tlaleletšo seo se utilwego le .sr-only
sehlopha.
Ka dipetšhe
Oketša dipetšhe go selo sefe goba sefe sa sehlopha sa lenaneo go bontšha dipalo tšeo di sa balwago, mošomo, le tše dingwe ka thušo ya didirišwa tše dingwe .
- Selo sa lenaneo14.
- Ntlha ya bobedi ya lenaneo2.
- Ntlha ya boraro ya lenaneo1. 1.
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-center">
A list item
<span class="badge badge-primary badge-pill">14</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
A second list item
<span class="badge badge-primary badge-pill">2</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
A third list item
<span class="badge badge-primary badge-pill">1</span>
</li>
</ul>
Diteng tša tlwaelo
Oketša mo e nyakilego go ba HTML efe goba efe ka gare, gaešita le bakeng sa dihlopha tša lenaneo tše di kgokagantšwego go swana le yeo e lego ka mo tlase, ka thušo ya didirišwa tša flexbox .
Lokeletša hlogo ya selo sa sehlopha
Matšatši a 3 a fetilegoDiteng tše dingwe tša seswaro sa lefelo temaneng.
Le diprintwa tše dingwe tše nnyane.Lokeletša hlogo ya selo sa sehlopha
Matšatši a 3 a fetilegoDiteng tše dingwe tša seswaro sa lefelo temaneng.
Gomme tše dingwe di kgaotše mongwalo o monyenyane.Lokeletša hlogo ya selo sa sehlopha
Matšatši a 3 a fetilegoDiteng tše dingwe tša seswaro sa lefelo temaneng.
Gomme tše dingwe di kgaotše mongwalo o monyenyane.<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">Some placeholder content in a paragraph.</p>
<small>And some small print.</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">Some placeholder content in a paragraph.</p>
<small class="text-muted">And some muted small print.</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">Some placeholder content in a paragraph.</p>
<small class="text-muted">And some muted small print.</small>
</a>
</div>
Boitshwaro bja JavaScript
Diriša thepo ya polaka ya JavaScript—e akaretše ka botee goba ka bootstrap.js
faele yeo e kgobokeditšwego—go katološa sehlopha sa rena sa lenaneo go hlama diphanephe tša thepo tša diteng tša lefelong leo.
<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>
Go šomiša dika tša datha
O ka tsenya tirišong go sepelasepela ga sehlopha sa lenaneo ntle le go ngwala JavaScript efe goba efe ka go no laetša data-toggle="list"
goba godimo ga elemente. Šomiša dika tše tša datha go .list-group-item
.
<div role="tabpanel">
<!-- 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>
</div>
Ka JavaScript
Kgontšha ntlha ya lenaneo la thepo ka JavaScript (ntlha ye nngwe le ye nngwe ya lenaneo e swanetše go tsenywa tirišong ka botee):
$('#myList a').on('click', function (event) {
event.preventDefault()
$(this).tab('show')
})
O ka tsenya tirišong selo sa lenaneo la motho ka o tee ka o tee ka ditsela tše mmalwa:
$('#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 phello
Go dira gore phanele ya dithepo e fifala ka gare, oketša .fade
go ye nngwe le ye nngwe .tab-pane
. Lefasetešana la thepo ya mathomo le lona le swanetše go ba le .show
go dira gore diteng tša mathomo di bonagale.
<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>
Mekgwa ya go šoma
$ (). thepo ya
E tsenya tirišong elemente ya selo sa lenaneo le setshelo sa diteng. Tab e swanetše go ba le e ka ba a data-target
goba a go href
nepiša noutu ya setshelo ka go 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>
.tab ('bontša') .
Kgetha aetheme ya lenaneo ye e filwego gomme e bontšha lefasetere la yona leo le amanago. Ntlha efe goba efe ye nngwe ya lenaneo yeo e bego e kgethilwe peleng e ba yeo e sa kgethwago gomme lefasetere la yona leo le amanago le lona le a utilwe. E boela go mogala pele lefasetere la thepo le bontšhitšwe e le ka kgonthe (mohlala, pele ga ge shown.bs.tab
tiragalo e direga).
$('#someListItem').tab('show')
Ditiragalo
Ge o bontšha thepo ye mpsha, ditiragalo di thunya ka tatelano ye e latelago:
hide.bs.tab
(go thepo ya bjale ye e šomago) .show.bs.tab
(go thepo yeo e tlago go bontšhwa)hidden.bs.tab
(go thepong ya go šoma ya peleng, e swanago le yahide.bs.tab
tiragalo)shown.bs.tab
(go thepong yeo e sa tšwago go bontšhwa yeo e sa tšwago go šoma, e swanago le yashow.bs.tab
tiragalo)
Ge e le gore ga go na thepo yeo e bego e šetše e šoma, ditiragalo tša hide.bs.tab
le hidden.bs.tab
di ka se thuntšwe.
Mohuta wa tiragalo | Tlhalošo |
---|---|
bontša.bs.tab | Tiragalo ye e thunya ka pontšho ya thepo, eupša pele ga ge thepo ye mpsha e bontšhitšwe. Šomiša event.target le event.relatedTarget go nepiša thepo ye e šomago le thepo ye e šomago ya peleng (ge e le gona) ka go latelelana. |
e bontšhitšwe.bs.tab | Tiragalo ye e thunya pontšhong ya thepo ka morago ga ge thepo e bontšhitšwe. Šomiša event.target le event.relatedTarget go nepiša thepo ye e šomago le thepo ye e šomago ya peleng (ge e le gona) ka go latelelana. |
pata.bs.thepo | Tiragalo ye e a tuka ge thepo ye mpsha e swanetše go bontšhwa (gomme ka go realo thepo ye e šomago ya peleng e swanetše go utollwa). Šomiša event.target le event.relatedTarget go nepiša thepo ya bjale ye e šomago le thepo ye mpsha yeo e tlago go šoma kgauswinyane, ka go latelelana. |
e utilwego.bs.tab | Tiragalo ye e thunya ka morago ga ge thepo ye mpsha e bontšhitšwe (gomme ka go realo thepo ye e šomago ya peleng e a utilwe). Šomiša event.target le event.relatedTarget go nepiša thepo ye e šomago ya peleng le thepo ye mpsha ye e šomago, ka go latelelana. |
$('a[data-toggle="list"]').on('shown.bs.tab', function (event) {
event.target // newly activated tab
event.relatedTarget // previous active tab
})