U gudub nuxurka muhiimka ah U gudub dukumentiyada navigation
in English

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.

  • Shay
  • Shay labaad
  • Shayga saddexaad
  • Shayga afraad
  • Iyo mid shanaad
<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>

Alaabada firfircoon

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

  • Shay firfircoon
  • Shay labaad
  • Shayga saddexaad
  • Shayga afraad
  • Iyo mid shanaad
<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>

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

  • Shay naafo ah
  • Shay labaad
  • Shayga saddexaad
  • Shayga afraad
  • Iyo mid shanaad
<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>

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" 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 href="#" class="list-group-item list-group-item-action disabled" tabindex="-1" aria-disabled="true">A disabled link item</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" 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>

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

  • Shay
  • Shay labaad
  • Shayga saddexaad
  • Shayga afraad
  • Iyo mid shanaad
<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>

La tiriyey

Ku dar .list-group-numberedfasalka wax ka beddelka (iyo ikhtiyaar ahaan isticmaal shay <ol>) si aad u doorato liiska liiska nambarada leh. Nambarada waxaa lagu soo saaraa CSS (oo ka <ol>duwan qaabka browser-ka caadiga ah) si loogu meeleeyo si ka wanaagsan gudaha liiska walxaha iyo si loogu oggolaado habaynta wanaagsan.

Nambarada waxaa lagu soo saaraa counter-resetdusha <ol>, ka dibna qaabeeya oo lagu dhejiyaa unug ::beforebeen abuur ah oo <li>leh counter-incrementiyo content.

  1. Cras justo odio
  2. Cras justo odio
  3. Cras justo odio
<ol class="list-group list-group-numbered">
  <li class="list-group-item">Cras justo odio</li>
  <li class="list-group-item">Cras justo odio</li>
  <li class="list-group-item">Cras justo odio</li>
</ol>

Kuwani waxay si fiican ugu shaqeeyaan nuxurka gaarka ah sidoo kale.

  1. Ciwaan hoosaadka
    Cras justo odio
    14
  2. Ciwaan hoosaadka
    Cras justo odio
    14
  3. Ciwaan hoosaadka
    Cras justo odio
    14
<ol class="list-group list-group-numbered">
  <li class="list-group-item d-flex justify-content-between align-items-start">
    <div class="ms-2 me-auto">
      <div class="fw-bold">Subheading</div>
      Cras justo odio
    </div>
    <span class="badge bg-primary rounded-pill">14</span>
  </li>
  <li class="list-group-item d-flex justify-content-between align-items-start">
    <div class="ms-2 me-auto">
      <div class="fw-bold">Subheading</div>
      Cras justo odio
    </div>
    <span class="badge bg-primary rounded-pill">14</span>
  </li>
  <li class="list-group-item d-flex justify-content-between align-items-start">
    <div class="ms-2 me-auto">
      <div class="fw-bold">Subheading</div>
      Cras justo odio
    </div>
    <span class="badge bg-primary rounded-pill">14</span>
  </li>
</ol>

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|xxl}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.

  • Shay
  • Shay labaad
  • Shayga saddexaad
  • Shay
  • Shay labaad
  • Shayga saddexaad
  • Shay
  • Shay labaad
  • Shayga saddexaad
  • Shay
  • Shay labaad
  • Shayga saddexaad
  • Shay
  • Shay labaad
  • Shayga saddexaad
  • Shay
  • Shay labaad
  • Shayga saddexaad
<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>
<ul class="list-group list-group-horizontal-xxl">
  <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>

Fasalada macnaha guud

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

  • Shayga liiska caadiga ah ee fudud
  • 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">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>

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">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>
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 .visually-hiddenfasalka 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 .

  • Shayga liiska14
  • Shayga liiska labaad2
  • Shayga liiska saddexaad1
<ul class="list-group">
  <li class="list-group-item d-flex justify-content-between align-items-center">
    A list item
    <span class="badge bg-primary rounded-pill">14</span>
  </li>
  <li class="list-group-item d-flex justify-content-between align-items-center">
    A second list item
    <span class="badge bg-primary rounded-pill">2</span>
  </li>
  <li class="list-group-item d-flex justify-content-between align-items-center">
    A third list item
    <span class="badge bg-primary rounded-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" aria-current="true">
    <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>

Sanduuqyada hubinta iyo raadiyaha

Geli sanduuqyada hubinta ee Bootstrap iyo raadiyaha gudaha liistada liiska oo habayso hadba sida loogu baahdo. Waxaad isticmaali kartaa <label>s la'aanteed, laakiin fadlan xasuuso inaad ku darto aria-labelsifo iyo qiimaha gelitaanka.

  • Sanduuqa hubinta koowaad
  • Sanduuqa hubinta labaad
  • Sanduuqa hubinta saddexaad
  • Sanduuqa hubinta afaraad
  • Sanduuqa hubinta shanaad
<ul class="list-group">
  <li class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="" aria-label="...">
    First checkbox
  </li>
  <li class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="" aria-label="...">
    Second checkbox
  </li>
  <li class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="" aria-label="...">
    Third checkbox
  </li>
  <li class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="" aria-label="...">
    Fourth checkbox
  </li>
  <li class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="" aria-label="...">
    Fifth checkbox
  </li>
</ul>

Oo haddii aad rabto <label>s sida meelaha .list-group-itemwaaweyn ee la garaacay, waxaad sidoo kale samayn kartaa taas.

<div class="list-group">
  <label class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="">
    First checkbox
  </label>
  <label class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="">
    Second checkbox
  </label>
  <label class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="">
    Third checkbox
  </label>
  <label class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="">
    Fourth checkbox
  </label>
  <label class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="">
    Fifth checkbox
  </label>
</div>

Sass

Kala duwanaansho

$list-group-color:                  $gray-900;
$list-group-bg:                     $white;
$list-group-border-color:           rgba($black, .125);
$list-group-border-width:           $border-width;
$list-group-border-radius:          $border-radius;

$list-group-item-padding-y:         $spacer * .5;
$list-group-item-padding-x:         $spacer;
$list-group-item-bg-scale:          -80%;
$list-group-item-color-scale:       40%;

$list-group-hover-bg:               $gray-100;
$list-group-active-color:           $component-active-color;
$list-group-active-bg:              $component-active-bg;
$list-group-active-border-color:    $list-group-active-bg;

$list-group-disabled-color:         $gray-600;
$list-group-disabled-bg:            $list-group-bg;

$list-group-action-color:           $gray-700;
$list-group-action-hover-color:     $list-group-action-color;

$list-group-action-active-color:    $body-color;
$list-group-action-active-bg:       $gray-200;

Isku qas

Loo adeegsaday in lagu daro $theme-colorssi loo soo saaro fasallada kala duwan ee macnaha guud ee .list-group-items.

@mixin list-group-item-variant($state, $background, $color) {
  .list-group-item-#{$state} {
    color: $color;
    background-color: $background;

    &.list-group-item-action {
      &:hover,
      &:focus {
        color: $color;
        background-color: shade-color($background, 10%);
      }

      &.active {
        color: $white;
        background-color: $color;
        border-color: $color;
      }
    }
  }
}

Loop

Loop oo soo saara fasalada wax ka beddelka ee isku- list-group-item-variant()dhafka ah.

// List group contextual variants
//
// Add modifier classes to change text and background color on individual items.
// Organizationally, this must come after the `:hover` states.

@each $state, $value in $theme-colors {
  $list-group-variant-bg: shift-color($value, $list-group-item-bg-scale);
  $list-group-variant-color: shift-color($value, $list-group-item-color-scale);
  @if (contrast-ratio($list-group-variant-bg, $list-group-variant-color) < $min-contrast-ratio) {
    $list-group-variant-color: mix($value, color-contrast($list-group-variant-bg), abs($list-group-item-color-scale));
  }

  @include list-group-item-variant($state, $list-group-variant-bg, $list-group-variant-color);
}

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-bs-toggle="list" href="#list-home" role="tab" aria-controls="list-home">Home</a>
      <a class="list-group-item list-group-item-action" id="list-profile-list" data-bs-toggle="list" href="#list-profile" role="tab" aria-controls="list-profile">Profile</a>
      <a class="list-group-item list-group-item-action" id="list-messages-list" data-bs-toggle="list" href="#list-messages" role="tab" aria-controls="list-messages">Messages</a>
      <a class="list-group-item list-group-item-action" id="list-settings-list" data-bs-toggle="list" href="#list-settings" role="tab" aria-controls="list-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-bs-toggle="list"ama curiye. Isticmaal sifaadkan xogta .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-bs-toggle="list" href="#home" role="tab">Home</a>
    <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#profile" role="tab">Profile</a>
    <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#messages" role="tab">Messages</a>
    <a class="list-group-item list-group-item-action" data-bs-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>

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

var triggerTabList = [].slice.call(document.querySelectorAll('#myTab a'))
triggerTabList.forEach(function (triggerEl) {
  var tabTrigger = new bootstrap.Tab(triggerEl)

  triggerEl.addEventListener('click', function (event) {
    event.preventDefault()
    tabTrigger.show()
  })
})

Waxaad u dhaqaajin kartaa shayga liiska gaarka ah dhowr siyaabood:

var triggerEl = document.querySelector('#myTab a[href="#profile"]')
bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name

var triggerFirstTabEl = document.querySelector('#myTab li:first-child a')
bootstrap.Tab.getInstance(triggerFirstTabEl).show() // Select first tab

Saamaynta libdhi

Si loo sameeyo tabs panel in ay libdhaan, ku dar .fademid kasta .tab-pane. Shabakadda tab ee 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

constructor

Wuxuu hawlgeliyaa shayga liiska iyo weelka ka kooban. Tabku waa inuu lahaadaa mid data-bs-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-bs-toggle="list" href="#home" role="tab">Home</a>
  <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#profile" role="tab">Profile</a>
  <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#messages" role="tab">Messages</a>
  <a class="list-group-item list-group-item-action" data-bs-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>
  var firstTabEl = document.querySelector('#myTab a:last-child')
  var firstTab = new bootstrap.Tab(firstTabEl)

  firstTab.show()
</script>

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

  var someListItemEl = document.querySelector('#someListItem')
  var tab = new bootstrap.Tab(someListItemEl)

  tab.show()

tuurid

Burburiyaa tabka curiyaha.

heliTusaale

Habka taagan kaas oo kuu ogolaanaya inaad hesho tusaale tab ah oo la xidhiidha curiyaha DOM

var triggerEl = document.querySelector('#trigger')
var tab = bootstrap.Tab.getInstance(triggerEl) // Returns a Bootstrap tab instance

heliOrCreateInstance

Habka taagan kaas oo kuu ogolaanaya inaad hesho tusaale tab ah oo la xidhiidha curiyaha DOM, ama abuurto mid cusub haddii aan la bilaabin

var triggerEl = document.querySelector('#trigger')
var tab = bootstrap.Tab.getOrCreateInstance(triggerEl) // Returns a Bootstrap tab instance

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 shidan tahay bandhiga tab, laakiin ka hor intaan tab cusub la muujin. Isticmaal event.targetoo event.relatedTargetsi aad u beegsato tab firfircoon iyo tabtii hore ee firfircoonayd (haddii la heli karo) siday u kala horreeyaan.
shown.bs.tab Dhacdadani waxay ku gubanaysaa bandhiga tab ka dib marka tab la muujiyo. Isticmaal event.targetoo event.relatedTargetsi aad u beegsato tab firfircoon iyo tabtii hore ee firfircoonayd (haddii la heli karo) siday u kala horreeyaan.
hide.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.relatedTargetsi aad u beegsato tab fir fircoon ee hadda jirta iyo tabka cusub ee dhawaan hawl-fulin doono, siday u kala horreeyaan.
hidden.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 tabka cusub ee firfircoon, siday u kala horreeyaan.
var tabElms = document.querySelectorAll('a[data-bs-toggle="list"]')
tabElms.forEach(function(tabElm) {
  tabElm.addEventListener('shown.bs.tab', function (event) {
    event.target // newly activated tab
    event.relatedTarget // previous active tab
  })
}