Source

Liiska kooxda

Kooxaha liisku waa qayb dabacsan oo awood badan si ay u muujiyaan taxane taxane ah. Wax ka beddel oo u fidi si ay u taageeraan wax kasta oo ku jira.

Tusaalaha aasaasiga ah

Kooxda liiska ugu aasaasiga ah waa liis aan la dalban oo ay ku jiraan shay liis ah iyo fasalo habboon. Ku dul dhis xulashooyinka soo socda, ama CSS kaaga haddii loo baahdo.

  • Cras justo odio
  • Dapibus ac facilisis in
  • Morbi leo risus
  • Porta ac consectetur ac
  • Vestibulum iyo 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>

Alaabada firfircoon

Ku dar .activesi aad .list-group-itemu muujiso doorashada firfircoon ee hadda

  • Cras justo odio
  • Dapibus ac facilisis in
  • Morbi leo risus
  • Porta ac consectetur ac
  • Vestibulum iyo 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>

Alaabta naafada ah

Ku dar .disabledsi .list-group-itemaad ugu ekaato mid naafo ah. Ogsoonow in qaar ka mid ah walxaha wata .disableday sidoo kale u baahan doonaan JavaScript-ka caadiga ah si ay si buuxda u baabi'iyaan dhacdooyinka gujintooda (tusaale, iskuxirayaasha).

  • Cras justo odio
  • Dapibus ac facilisis in
  • Morbi leo risus
  • Porta ac consectetur ac
  • Vestibulum iyo 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>

Isticmaal <a>s ama <button>s si aad u abuurto liiska wax qabad ee shayyada kooxda oo leh dullid , naafo, iyo gobolo firfircoon adoo ku daraya .list-group-item-action. Waxaan u kala saarnay fasaladan been abuurka ah si aan u hubinno kooxaha liiska ka samaysan ee ka samaysan walxaha aan is-dhexgal ahayn (sida <li>s ama <div>s) ayan bixin wax riix ah ama taabasho lacag bixin ah.

U hubso inaadan isticmaalin .btnfasalada caadiga ah halkan .

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

s , <button>waxa kale oo aad isticmaali kartaa disabledsifada halkii aad ka isticmaali lahayd .disabledfasalka. Nasiib darrose, <a>s ma taageeraan sifada naafada.

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

Biyo raaci

Ku dar .list-group-flushsi aad uga saarto qaar ka mid ah xuduudaha iyo geesaha wareegsan si aad ugu muujiso liiska walxaha gees-ilaa-geeska weelka waalidka (tusaale, kaararka).

  • Cras justo odio
  • Dapibus ac facilisis in
  • Morbi leo risus
  • Porta ac consectetur ac
  • Vestibulum iyo 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>

Horizontal

Ku dar .list-group-horizontalsi aad u beddesho qaabka liiska walxaha kooxda ka toosan una beddelo meel siman dhammaan meelaha jaban. Haddii kale, dooro kala duwanaansho jawaab .list-group-horizontal-{sm|md|lg|xl}celin leh si aad koox liis ah uga dhigto mid toosan oo ka bilaabmaya barta jabinta min-width. Hadda kooxaha liiska jiifka ah laguma dari karo kooxaha liistada.

ProTip: Ma rabtaa shay kooxeedka liiska ballaca siman marka ay toosan tahay? Ku dar .flex-fillliis kasta shay kooxeed

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

Fasalada macnaha guud

Isticmaal fasalo macnaha guud si aad u habayso liiska walxaha leh asal dawladeed iyo midab.

  • Dapibus ac facilisis in
  • Shayga liiska aasaasiga ah ee fudud
  • Shayga liiska sare ee fudud
  • Shayga liiska guusha fudud
  • Shayga liiska khatarta fudud
  • Shayga liiska digniinta fudud
  • Shayga liiska macluumaadka fudud
  • Shayga liiska fudud ee fudud
  • Shayga liiska madow fudud
<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>

Fasallada macnuhu waxa kale oo ay la shaqeeyaan .list-group-item-action. U fiirso ku darida qaababka dullidda halkan kuma jiraan tusaalihii hore. Waxa kale oo la taageeraa .activedawladda; Codso si aad u muujiso xulashada firfircoon ee shayga liiska macnaha guud.

<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>
U gudbinta macnaha tignoolajiyada caawinta

Isticmaalka midabka si loogu daro macnaha kaliya waxay bixisaa tilmaam muuqaal ah, taas oo aan loo gudbin doonin isticmaalayaasha tignoolajiyada caawinta - sida akhristayaasha shaashadda. Hubi in macluumaadka lagu tilmaamay midabku ay ka cad yihiin waxa ku jira laftiisa (tusaale qoraalka muuqda), ama lagu soo daro habab kale, sida qoraal dheeraad ah oo .sr-onlyfasalka dhexdiisa ku qarsoon.

Calaamado wata

Ku dar calaamado liis kasta shay kooxeed si aad u muujiso tirooyinka aan la akhriyin, nashaadaadka, iyo wax ka badan iyadoo la kaashanayo adeegyada qaarkood .

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

Waxyaabaha gaarka ah

Ku dar ku dhawaad ​​HTML kasta, xitaa kooxaha liiska ku xiran sida kan hoose, iyadoo la kaashanayo flexbox utilities .

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

Dhaqanka JavaScript

Isticmaal tab JavaScript plugin-ku dar si gaar ah ama iyada oo loo marayo bootstrap.jsfaylka la soo ururiyey-si loo kordhiyo kooxdayada liiska si aan u abuurno muraayado la taaban karo oo ka kooban gudaha.

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

Isticmaalka sifooyinka xogta

Waxaad dhaqaajin kartaa liis kooxeed navigation adoon qorin wax JavaScript ah adiga oo si fudud u qeexaya data-toggle="list"ama curiye. Isticmaal sifaadkan xogta .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>

Iyadoo loo marayo JavaScript

U oggolow liiska shayga la taaban karo iyada oo loo marayo JavaScript ( shayga liis kastaa wuxuu u baahan yahay in si gaar ah loo hawlgeliyo):

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

Waxaad u dhaqaajin kartaa shayga liiska gaarka ah dhowr siyaabood:

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

Saamaynta libdhi

Si loo sameeyo tabs panel in ay libdhaan, ku dar .fademid kasta .tab-pane. Shabakadda ugu horreysa waa inay sidoo kale ka .showdhigtaa nuxurka bilowga ah mid muuqda.

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

Hababka

$() tab

Wuxuu hawlgeliyaa walxaha liiska iyo weelka ka kooban. Tabku waa inuu lahaadaa mid data-targetama meel la hrefbeegsanayo noodhka weelka ee 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('show')

Wuxuu doortaa shayga liiska la bixiyay oo tusaya shayga la xidhiidha. Shayga kale ee liiska hore loo doortay waxa uu noqdaa mid aan la dooran oo shayga la xidhiidha waa qarsoon yahay. Ku soo noqoshada soo wacaha ka hor inta aan la tusin muraayadda tab (tusaale, ka hor intaanay shown.bs.tabdhacdada dhicin).

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

Dhacdooyinka

Marka la tuso tab cusub, dhacdooyinku waxay u dabcaan sida soo socota:

  1. hide.bs.tab(ku yaal tab firfircoon ee hadda)
  2. show.bs.tab(ku yaal tabka lagu soo bandhigi doono)
  3. hidden.bs.tab(ee tabtii hore ee firfircoonayd, oo la mid ah hide.bs.tabdhacdada)
  4. shown.bs.tab(oo ku yaal tab cusub oo firfircoon, oo la mid ah show.bs.tabdhacdada)

Haddi aanu tab hore u shaqayn, dhacdooyinka hide.bs.tabiyo hidden.bs.tabdhacdooyinka lama eryo

Nooca dhacdada Sharaxaada
show.bs.tab Dhacdadani waxay ku socotaa bandhigga tab, laakiin ka hor intaan tab cusub la muujin. Isticmaal event.targetoo event.relatedTargetaad beegsato tab firfircooni iyo tabtii hore ee firfircoonayd (haddii la heli karo) siday u kala horreeyaan.
tusay.bs.tab Dhacdadani waxay ku gubanaysaa bandhiga tab ka dib marka tab la tuso. Isticmaal event.targetoo event.relatedTargetaad beegsato tab firfircooni iyo tabtii hore ee firfircoonayd (haddii la heli karo) siday u kala horreeyaan.
qari.bs.tab Dhacdadani waxay dab kacaysaa marka tab cusub la muujinayo (oo sidaas awgeed tabtii hore ee firfircoonayd waa in la qariyaa). Isticmaal event.targetoo event.relatedTargetaad beegsato tab firfircoon ee hadda iyo ta cusub ee dhawaan-wax-qaban doona, siday u kala horreeyaan.
qarsoon.bs.tab Dhacdadani waxay dabaysaa ka dib marka tab cusub la muujiyo (oo sidaas awgeed tabtii hore ee firfircoonayd ayaa qarsoon). Isticmaal event.targetoo event.relatedTargetaad beegsato tabtii hore ee firfircoonayd iyo tab cusub ee firfircoon, siday u kala horreeyaan.
$('a[data-toggle="list"]').on('shown.bs.tab', function (e) {
  e.target // newly activated tab
  e.relatedTarget // previous active tab
})