Holo i ka ʻike nui Holo i ka hoʻokele docs
Check
in English

Carousel

He kiʻi kiʻi kiʻi no ka holo kaʻa ʻana ma waena o nā mea—nā kiʻi a i ʻole nā ​​paheʻe kikokikona—e like me ka carousel.

Pehea e hana ai

ʻO ka carousel kahi kiʻi kiʻiʻoniʻoni no ka holo kaʻa ʻana ma o ke ʻano o ka ʻike, i kūkulu ʻia me CSS 3D transforms a me kahi mea JavaScript. Hoʻohana ia me nā kiʻi, kikokikona, a i ʻole markup maʻamau. Loaʻa pū kekahi i ke kākoʻo no nā mana mua / aʻe a me nā hōʻailona.

Ma nā polokalamu kele pūnaewele kahi i kākoʻo ʻia ai ka API Visibility ʻAoʻao , e pale ka carousel i ka paheʻe ʻana ke ʻike ʻole ʻia ka ʻaoʻao pūnaewele e ka mea hoʻohana (e like me ka wā ʻaʻole hoʻohana ʻia ka ʻaoʻao polokalamu kele pūnaewele, hoʻemi ʻia ka puka aniani, etc.).

ʻO ka hopena animation o kēia māhele e pili ana i ka prefers-reduced-motionnīnau media. E ʻike i ka ʻāpana hoʻohaʻahaʻa o kā mākou palapala hiki ke komo .

E ʻoluʻolu e hoʻomaopopo ʻaʻole kākoʻo ʻia nā carousels pūnana, a ʻaʻole kūlike nā carousels i nā kūlana hiki ke loaʻa.

Laʻana

ʻAʻole hana maʻamau nā Carousels i nā ana paheʻe. No laila, pono paha ʻoe e hoʻohana i nā pono hana hou a i ʻole nā ​​​​ʻano maʻamau i ka nui o ka ʻike. ʻOiai ke kākoʻo nei nā carousels i nā mana a me nā hōʻailona o mua/hope aku, ʻaʻole koi ʻia lākou. Hoʻohui a hoʻopilikino e like me kou manaʻo pono.

Pono .activee hoʻohui ʻia ka papa i kekahi o nā paheʻe i ʻole e ʻike ʻia ka carousel. E ʻoluʻolu hoʻi e hoʻonoho i kahi ʻokoʻa idno .carouselnā mana koho, ʻoi aku paha inā ʻoe e hoʻohana ana i nā carousels he nui ma ka ʻaoʻao hoʻokahi. Pono nā mea hoʻomalu a me nā mea hōʻike e loaʻa i kahi data-bs-targetʻano (a i ʻole hrefno nā loulou) i kūpono i ka mea ido ka .carouselmea.

Paheʻe wale

Eia kahi carousel me nā paheʻe wale nō. E hoʻomaopopo i ka loaʻa ʻana o nā kiʻi carousel .d-blocka .w-100ma luna o nā kiʻi carousel e pale ai i ka hoʻolikelike kiʻi paʻamau.

html
<div id="carouselExampleSlidesOnly" class="carousel slide" data-bs-ride="carousel">
  <div class="carousel-inner">
    <div class="carousel-item active">
      <img src="..." class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
    </div>
  </div>
</div>

Me nā mana

Hoʻohui i nā mana mua a me ka hope. Manaʻo mākou e hoʻohana i <button>nā mea, akā hiki iā ʻoe ke hoʻohana pū i <a>nā mea me role="button".

html
<div id="carouselExampleControls" class="carousel slide" data-bs-ride="carousel">
  <div class="carousel-inner">
    <div class="carousel-item active">
      <img src="..." class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
    </div>
  </div>
  <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Previous</span>
  </button>
  <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Next</span>
  </button>
</div>

Me nā hōʻailona

Hiki iā ʻoe ke hoʻohui i nā hōʻailona i ka carousel, me ka ʻaoʻao o nā mana.

html
<div id="carouselExampleIndicators" class="carousel slide" data-bs-ride="true">
  <div class="carousel-indicators">
    <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
    <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="1" aria-label="Slide 2"></button>
    <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="2" aria-label="Slide 3"></button>
  </div>
  <div class="carousel-inner">
    <div class="carousel-item active">
      <img src="..." class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
    </div>
  </div>
  <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Previous</span>
  </button>
  <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Next</span>
  </button>
</div>

Me nā huaʻōlelo

Hoʻohui maʻalahi i nā huaʻōlelo i kāu mau paheʻe me ka .carousel-captionmea i loko o kekahi .carousel-item. Hiki iā lākou ke hūnā maʻalahi ma nā wahi nānā liʻiliʻi, e like me ka mea i hōʻike ʻia ma lalo nei, me nā pono hōʻike koho . Huna mua mākou iā lākou .d-noneme ka hoʻihoʻi ʻana iā lākou ma nā hāmeʻa liʻiliʻi me .d-md-block.

html
<div id="carouselExampleCaptions" class="carousel slide" data-bs-ride="false">
  <div class="carousel-indicators">
    <button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
    <button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="1" aria-label="Slide 2"></button>
    <button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="2" aria-label="Slide 3"></button>
  </div>
  <div class="carousel-inner">
    <div class="carousel-item active">
      <img src="..." class="d-block w-100" alt="...">
      <div class="carousel-caption d-none d-md-block">
        <h5>First slide label</h5>
        <p>Some representative placeholder content for the first slide.</p>
      </div>
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
      <div class="carousel-caption d-none d-md-block">
        <h5>Second slide label</h5>
        <p>Some representative placeholder content for the second slide.</p>
      </div>
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
      <div class="carousel-caption d-none d-md-block">
        <h5>Third slide label</h5>
        <p>Some representative placeholder content for the third slide.</p>
      </div>
    </div>
  </div>
  <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Previous</span>
  </button>
  <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Next</span>
  </button>
</div>

Crossfade

Hoʻohui .carousel-fadei kāu carousel e hoʻolalelale i nā kiʻi paheʻe me kahi hoʻololi mae ma mua o kahi paheʻe. Ma muli o kāu ʻike carousel (e laʻa, nā paheʻe kikokikona wale nō), makemake paha ʻoe e hoʻohui a i .bg-bodyʻole kekahi CSS maʻamau i nā .carousel-items no ka hoʻololi ʻana kūpono.

html
<div id="carouselExampleFade" class="carousel slide carousel-fade" data-bs-ride="carousel">
  <div class="carousel-inner">
    <div class="carousel-item active">
      <img src="..." class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
    </div>
  </div>
  <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleFade" data-bs-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Previous</span>
  </button>
  <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleFade" data-bs-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Next</span>
  </button>
</div>

Hoʻohui data-bs-interval=""i kahi .carousel-iteme hoʻololi i ka nui o ka manawa e hoʻopaneʻe ai ma waena o ka holo kaʻa ʻakomi i ka mea aʻe.

html
<div id="carouselExampleInterval" class="carousel slide" data-bs-ride="carousel">
  <div class="carousel-inner">
    <div class="carousel-item active" data-bs-interval="10000">
      <img src="..." class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item" data-bs-interval="2000">
      <img src="..." class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
    </div>
  </div>
  <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleInterval" data-bs-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Previous</span>
  </button>
  <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleInterval" data-bs-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Next</span>
  </button>
</div>

E hoʻopaʻa i ka paʻi ʻana

Kākoʻo nā Carousels i ka hili ʻana i ka hema/'ākau ma nā ʻaoʻao paʻi lima e neʻe ai ma waena o nā paheʻe. Hiki ke hoʻopau ʻia kēia me ka hoʻohana ʻana i ke ʻano data-bs-touch. ʻAʻole hoʻokomo ʻia ka hiʻohiʻona i ka laʻana ma lalo nei data-bs-rideno laila ʻaʻole ia e pāʻani auto.

html
<div id="carouselExampleControlsNoTouching" class="carousel slide" data-bs-touch="false">
  <div class="carousel-inner">
    <div class="carousel-item active">
      <img src="..." class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
    </div>
  </div>
  <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControlsNoTouching" data-bs-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Previous</span>
  </button>
  <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleControlsNoTouching" data-bs-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Next</span>
  </button>
</div>

ʻAno ʻeleʻele

Hoʻohui .carousel-darki ka .carouselno nā mana ʻeleʻele, nā hōʻailona, ​​a me nā captions. Ua hoʻohuli ʻia nā mana mai kā lākou hoʻopiha piha keʻokeʻo me ka filterwaiwai CSS. Loaʻa i nā captions a me nā mana nā hoʻololi Sass hou e hoʻopilikino i ka colora me background-color.

html
<div id="carouselExampleDark" class="carousel carousel-dark slide" data-bs-ride="carousel">
  <div class="carousel-indicators">
    <button type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
    <button type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="1" aria-label="Slide 2"></button>
    <button type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="2" aria-label="Slide 3"></button>
  </div>
  <div class="carousel-inner">
    <div class="carousel-item active" data-bs-interval="10000">
      <img src="..." class="d-block w-100" alt="...">
      <div class="carousel-caption d-none d-md-block">
        <h5>First slide label</h5>
        <p>Some representative placeholder content for the first slide.</p>
      </div>
    </div>
    <div class="carousel-item" data-bs-interval="2000">
      <img src="..." class="d-block w-100" alt="...">
      <div class="carousel-caption d-none d-md-block">
        <h5>Second slide label</h5>
        <p>Some representative placeholder content for the second slide.</p>
      </div>
    </div>
    <div class="carousel-item">
      <img src="..." class="d-block w-100" alt="...">
      <div class="carousel-caption d-none d-md-block">
        <h5>Third slide label</h5>
        <p>Some representative placeholder content for the third slide.</p>
      </div>
    </div>
  </div>
  <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleDark" data-bs-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Previous</span>
  </button>
  <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleDark" data-bs-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Next</span>
  </button>
</div>

Hoʻololi maʻamau

Hiki ke hoʻololi ʻia ka lōʻihi o .carousel-itemka hoʻololi ʻana me ka $carousel-transition-durationhoʻololi Sass ma mua o ka hōʻuluʻulu ʻana a i ʻole ke ʻano maʻamau inā ʻoe e hoʻohana ana i ka CSS i hōʻuluʻulu ʻia. Inā hoʻohana ʻia nā hoʻololi he nui, e hōʻoia e wehewehe mua ʻia ka hoʻololi hoʻololi (e laʻa transition: transform 2s ease, opacity .5s ease-out.

Sass

Nā mea hoʻololi

Nā hoʻololi no nā carousels āpau:

$carousel-control-color:             $white;
$carousel-control-width:             15%;
$carousel-control-opacity:           .5;
$carousel-control-hover-opacity:     .9;
$carousel-control-transition:        opacity .15s ease;

$carousel-indicator-width:           30px;
$carousel-indicator-height:          3px;
$carousel-indicator-hit-area-height: 10px;
$carousel-indicator-spacer:          3px;
$carousel-indicator-opacity:         .5;
$carousel-indicator-active-bg:       $white;
$carousel-indicator-active-opacity:  1;
$carousel-indicator-transition:      opacity .6s ease;

$carousel-caption-width:             70%;
$carousel-caption-color:             $white;
$carousel-caption-padding-y:         1.25rem;
$carousel-caption-spacer:            1.25rem;

$carousel-control-icon-width:        2rem;

$carousel-control-prev-icon-bg:      url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='#{$carousel-control-color}'><path d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/></svg>");
$carousel-control-next-icon-bg:      url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='#{$carousel-control-color}'><path d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/></svg>");

$carousel-transition-duration:       .6s;
$carousel-transition:                transform $carousel-transition-duration ease-in-out; // Define transform transition first if using multiple transitions (e.g., `transform 2s ease, opacity .5s ease-out`)

Nā hoʻololi no ka carousel ʻeleʻele :

$carousel-dark-indicator-active-bg:  $black;
$carousel-dark-caption-color:        $black;
$carousel-dark-control-icon-filter:  invert(1) grayscale(100);

Hoʻohana

Ma o nā hiʻohiʻona ʻikepili

E hoʻohana i nā hiʻohiʻona ʻikepili e hoʻomalu maʻalahi i ke kūlana o ka carousel. data-bs-slideʻae i nā huaʻōlelo a i prevʻole next, e hoʻololi i ke kūlana paheʻe e pili ana i kona kūlana i kēia manawa. ʻO kahi ʻē aʻe, e hoʻohana data-bs-slide-toi ka hāʻawi ʻana i kahi papa kuhikuhi paheʻe maka i ka carousel data-bs-slide-to="2", e hoʻololi i ke kūlana paheʻe i kahi kuhikuhi kikoʻī e hoʻomaka ana me 0.

Hoʻohana data-bs-ride="carousel"ʻia ka ʻano e hōʻailona ai i kahi carousel ma ke ʻano he animating e hoʻomaka ana ma ka hoʻouka ʻana i ka ʻaoʻao. Inā ʻaʻole ʻoe e hoʻohana data-bs-ride="carousel"e hoʻomaka i kāu carousel, pono ʻoe e hoʻomaka iā ʻoe iho. ʻAʻole hiki ke hoʻohana pū ʻia me (nui a pono ʻole) ka hoʻomaka mua ʻana o JavaScript o ka carousel like.

Ma o JavaScript

Kāhea lima ʻia ka carousel me:

const carousel = new bootstrap.Carousel('#myCarousel')

Nā koho

Hiki ke hāʻawi ʻia nā koho ma o nā ʻikepili a i ʻole JavaScript, hiki iā ʻoe ke hoʻohui i kahi inoa koho i data-bs-, e like me ka data-bs-animation="{value}". E hōʻoia e hoʻololi i ke ʻano hihia o ka inoa koho mai " CamelCase " i " kebab-case " i ka wā e hāʻawi ai i nā koho ma o nā ʻano ʻikepili. No ka laʻana, hoʻohana data-bs-custom-class="beautifier"ma kahi o data-bs-customClass="beautifier".

E like me Bootstrap 5.2.0, kākoʻo nā ʻāpana āpau i kahi hiʻohiʻona ʻikepili i mālama ʻiadata-bs-config i hiki ke mālama i ka hoʻonohonoho ʻāpana maʻalahi ma ke ʻano he kaula JSON. Ke loaʻa nā ʻano mea data-bs-config='{"delay":0, "title":123}'a me data-bs-title="456"nā ʻano, ʻo ka titlewaiwai hope loa 456a na nā ʻano ʻikepili kaʻawale e kāpae i nā waiwai i hāʻawi ʻia ma data-bs-config. Eia kekahi, hiki i nā ʻikepili ʻikepili ke hoʻopaʻa i nā waiwai JSON e like me data-bs-delay='{"show":0,"hide":150}'.

inoa ʻAno Default wehewehe
interval helu 5000 ʻO ka nui o ka manawa e hoʻopaneʻe ai ma waena o ke kaʻa ʻakomi i kahi mea.
keyboard boolean true Inā paha e pane ka carousel i nā hanana keyboard.
pause kaula, boolean "hover" Inā hoʻonoho ʻia i "hover", hoʻomaha i ke kaʻa kaʻa o ka carousel mouseentera hoʻomaka hou i ke kaʻa kaʻa o ka carousel ma mouseleave. Inā hoʻonoho ʻia iā false, ʻaʻole e hoʻomaha ke kau ʻana ma luna o ka carousel. Ma nā hāmeʻa hiki ke hoʻopā, ke hoʻonoho ʻia iā "hover", e hoʻomaha ke kaʻa uila touchend(ke pau ka mea hoʻohana i ka launa pū ʻana me ka carousel) no ʻelua manawa, ma mua o ka hoʻomaka ʻana. Hoʻohui kēia i ka hana ʻiole.
ride kaula, boolean false Inā hoʻonoho ʻia iā true, hoʻokani ʻakomi i ka carousel ma hope o ka holo lima ʻana o ka mea hoʻohana i ka mea mua. Inā hoʻonoho ʻia iā "carousel", hoʻokani auto i ka carousel ma ka hoʻouka ʻana.
touch boolean true Inā paha e kākoʻo ka carousel i ka hoʻopili ʻana i ka swipe hema a ʻākau ma nā hāmeʻa touchscreen.
wrap boolean true Inā pono ke kaʻa kaʻa kaʻa kaʻa kaʻa a i ʻole ka paʻakikī.

Nā ʻano hana

Nā ʻano asynchronous a me nā hoʻololi

Asynchronous nā ala API āpau a hoʻomaka i kahi hoʻololi . Hoʻi lākou i ka mea kelepona i ka wā e hoʻomaka ai ka hoʻololi akā ma mua o ka pau ʻana . Eia kekahi, e nānā ʻole ʻia kahi ala e kāhea ai i kahi mea hoʻololi .

E ʻike i kā mākou palapala JavaScript no ka ʻike hou aku .

Hiki iā ʻoe ke hana i kahi laʻana carousel me ka mea hana carousel, no ka laʻana, e hoʻomaka me nā koho hou aʻe a hoʻomaka i ka holo kaʻa i nā mea:

const myCarouselElement = document.querySelector('#myCarousel')
const carousel = new bootstrap.Carousel(myCarouselElement, {
  interval: 2000,
  wrap: false
})
Kaʻina hana wehewehe
cycle Kaʻapuni i nā mea carousel mai ka hema a i ka ʻākau.
dispose Hoʻopau i ka carousel o kekahi mea. (Wehe i ka ʻikepili i mālama ʻia ma ka mea DOM)
getInstance ʻO ke ala static e hiki ai iā ʻoe ke kiʻi i ke ʻano carousel pili i kahi mea DOM, hiki iā ʻoe ke hoʻohana e like me kēia: bootstrap.Carousel.getInstance(element).
getOrCreateInstance ʻO ke ʻano static e hoʻihoʻi i kahi laʻana carousel e pili ana i kahi mea DOM a i ʻole e hana i kahi mea hou inā ʻaʻole i hoʻomaka ʻia. Hiki iā ʻoe ke hoʻohana e like me kēia: bootstrap.Carousel.getOrCreateInstance(element).
next Hoʻoholo i ka mea aʻe. E hoʻi i ka mea kelepona ma mua o ka hōʻike ʻia ʻana o ka mea aʻe (e laʻa, ma mua o ka hiki ʻana o ka slid.bs.carouselhanana).
nextWhenVisible Mai kaʻa i ka carousel i ka wā ʻaʻole ʻike ʻia ka ʻaoʻao a ʻaʻole ʻike ʻia ka carousel a i ʻole kona makua. Hoʻi i ka mea kelepona ma mua o ka hōʻike ʻia ʻana o ka mea i manaʻo ʻia .
pause Hoʻopau i ka carousel mai ka holo paikikala ma nā mea.
prev Hoʻoholo i ka mea mua. Hoʻi i ka mea kelepona ma mua o ka hōʻike ʻia ʻana o ka mea mua (e laʻa, ma mua o ka hiki ʻana o ka slid.bs.carouselhanana).
to Hoʻololi i ka carousel i kahi kiʻi kikoʻī (ma muli o 0, e like me kahi array). Hoʻi i ka mea kelepona ma mua o ka hōʻike ʻia ʻana o ka mea i manaʻo ʻia (e laʻa, ma mua o ka hiki ʻana o ka slid.bs.carouselhanana).

Nā hanana

Hōʻike ka papa carousel o Bootstrap i ʻelua hanana no ka hoʻopili ʻana i ka hana carousel. Loaʻa i nā hanana ʻelua nā waiwai hou aʻe:

  • direction: ʻO ka ʻaoʻao e heʻe ana ka carousel (a i "left"ʻole "right").
  • relatedTarget: ʻO ka mea DOM e hoʻoneʻe ʻia ana ma ke ʻano he mea hana.
  • from: Ka papa kuhikuhi o ka mea o keia manawa
  • to: Ka papa kuhikuhi o ka mea aʻe

Hoʻopau ʻia nā hanana carousel a pau i ka carousel ponoʻī (ʻo ia hoʻi ma ka <div class="carousel">).

ʻAno hanana wehewehe
slid.bs.carousel Hoʻopau ʻia ka carousel i kāna hoʻololi paheʻe.
slide.bs.carousel E puhi koke ʻia ke slidekāhea ʻia ke ʻano hana.
const myCarousel = document.getElementById('myCarousel')

myCarousel.addEventListener('slide.bs.carousel', event => {
  // do something...
})