Ekyuma ekiyitibwa Carousel
Ekitundu kya slideshow eky’okutambula mu elementi —ebifaananyi oba slides z’ebiwandiiko —nga carousel.
Carousel ye slideshow ey’okuvuga obugaali okuyita mu lunyiriri lw’ebirimu, ezimbiddwa n’enkyukakyuka za CSS 3D n’akatono aka JavaScript. Kikola n’ebifaananyi ebiddiriŋŋana, ebiwandiiko, oba obubonero obw’enjawulo. Era erimu okuwagira okufuga okw’emabega/okuddako n’ebiraga.
Mu browsers nga Page Visibility API ewagirwa, carousel ejja kwewala okusereba nga webpage telabika eri omukozesa (nga nga browser tab tekola, browser window ekendeezeddwa, n’ebirala).
Nsaba omanye nti nested carousels teziwagirwa, era carousels okutwalira awamu tezituukana na mutindo gwa kutuuka.
Ekisembayo, bw'oba ozimba JavaScript yaffe okuva ku nsibuko, kyetaagisautil.js
.
Carousels tezizza bipimo bya slide mu ngeri ya bulijjo mu ngeri ey’otoma. Nga bwe kiri, oyinza okwetaaga okukozesa ebikozesebwa ebirala oba emisono egy’enjawulo okusobola okugerageranya obulungi ebirimu. Wadde nga carousels ziwagira ebifuga eby'emabega/ebiddako n'ebiraga, tebyetaagisa mu bulambulukufu. Okwongerako era okole nga bw’olaba.
Kakasa nti oteeka id ey'enjawulo ku .carousel
for optional controls, naddala nga okozesa carousels eziwera ku lupapula lumu.
Wano waliwo carousel eriko slides zokka. Weetegereze okubeerawo kwa .d-block
ne .img-fluid
ku bifaananyi bya carousel okuziyiza okulaganya ebifaananyi kwa browser okusookerwako.
<div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="..." alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="..." alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="..." alt="Third slide">
</div>
</div>
</div>
Okwongerako mu bifuga eby’emabega n’ebiddako:
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="..." alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="..." alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="..." alt="Third slide">
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
Osobola n’okugattako ebiraga ku carousel, ku mabbali g’ebifuga, nabyo.
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="..." alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="..." alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="..." alt="Third slide">
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
Element ekola esooka kyetaagisa
Ekibiina .active
kyetaaga okugattibwa ku emu ku slayidi. Bwe kitaba ekyo, carousel tejja kulabika.
Okwongera ebigambo ku slide zo mu ngeri ennyangu nga .carousel-caption
elementi eri munda mu .carousel-item
. Ziyinza okwanguyirwa okukwekebwa ku bifo ebitono eby’okulaba, nga bwe kiragibwa wansi, n’ebikozesebwa eby’okwolesebwa eby’okwesalirawo . Tuzikweka mu kusooka .d-none
ne tuzikomyawo ku byuma ebya sayizi eya wakati nga tulina .d-md-block
.
Kozesa data attributes okwanguyirwa okufuga ekifo kya carousel. data-slide
ekkiriza ebigambo ebikulu prev
oba next
, ekikyusa ekifo kya slayidi okusinziira ku kifo kyayo ekiriwo kati. Ekirala, kozesa data-slide-to
okuyisa omuwendo gwa slayidi embisi ku carousel data-slide-to="2"
, ekikyusa ekifo kya slayidi okudda ku muwendo ogw’enjawulo okutandika ne 0
.
Attribute data-ride="carousel"
ekozesebwa okussaako akabonero ku carousel nga animating okutandika ku page load. Tesobola kukozesebwa wamu ne (redundant and unnecessary) okutandika kwa JavaScript okw’olwatu okwa carousel y’emu.
Kuba carousel mu ngalo nga okozesa:
Ebyokulonda bisobola okuyisibwa nga biyita mu data attributes oba JavaScript. Ku bikwata ku data, ssaako erinnya ly'okulonda ku data-
, nga mu data-interval=""
.
Erinnya | Okuwandiika | Okukosamu | Okunnyonnyola |
---|---|---|---|
interval | omuwendo | 5000 | Omuwendo gw’obudde okulwawo wakati w’okuvuga ekintu mu ddigi mu ngeri ey’otoma. Bwe kiba kya bulimba, carousel tejja kutambula butereevu. |
ekitabo ekikwata ku kibboodi | boolean | kituufu | Oba carousel erina okuddamu ku bibaddewo ku keyboard. |
okuyimirizamu | olunyiriri | boolean | "okuwuubaala". | Singa eteekebwa ku Ku byuma ebisobola okukwata, bwe biteekebwa ku |
okusotta | akaguwa | -kyaamu | Autoplays the carousel oluvannyuma lw'omukozesa okuzingulula ekintu ekisooka mu ngalo. Singa "carousel", autoplays carousel ku load. |
okuzinga | boolean | kituufu | Oba carousel erina okutambula obutasalako oba okuba n’ebifo ebikaluba. |
Enkola ezitakwatagana n’enkyukakyuka
Enkola zonna eza API tezikwatagana era zitandika enkyukakyuka . Zidda eri oyo akubye amangu ddala ng'enkyukakyuka etandise naye nga tennaggwa . Okugatta ku ekyo, okuyita enkola ku kitundu ekikyukakyuka kujja kubuusibwa amaaso .
Laba ebiwandiiko byaffe ebya JavaScript okumanya ebisingawo.
Atandikawo carousel n’enkola ez’okwesalirawo object
n’atandika okuvuga obugaali ng’ayita mu bintu.
Ezingulula okuyita mu bintu bya carousel okuva ku kkono okudda ku ddyo.
Ayimiriza carousel okuvuga obugaali okuyita mu bintu.
Ezingulula carousel ku fuleemu entongole (0 okusinziira, okufaananako n'ensengekera). Edda eri oyo ayita nga ekintu ekigendererwa tekinnalagibwa (kwe kugamba nga slid.bs.carousel
ekintu tekinnabaawo).
Enzirukanya okutuuka ku kintu ekyayita. Edda eri oyo ayita nga ekintu ekyasooka tekinnalagibwa (kwe kugamba nga slid.bs.carousel
ekintu tekinnabaawo).
Ezingulula okutuuka ku kintu ekiddako. Edda eri oyo akubira nga ekintu ekiddako tekinnalagibwa (kwe kugamba nga slid.bs.carousel
ekintu tekinnabaawo).
Asaanyaawo carousel ya elementi.
Bootstrap's carousel class eraga ebibaddewo bibiri eby'oku hooking mu carousel functionality. Ebintu byombi birina eby’obugagga bino wammanga eby’okwongerako:
direction
: Obulagirizi carousel mw’eseeyeeya (oba"left"
oba"right"
).relatedTarget
: Ekintu kya DOM ekiseerezebwa mu kifo nga ekintu ekikola.from
: Omuwendo gw'ekintu ekiriwo katito
: Omuko gw'ekintu ekiddako
Ebintu byonna ebibaawo mu carousel bikubwa ku carousel yennyini (kwe kugamba ku <div class="carousel">
).
Ekika ky’Ekibaddewo | Okunnyonnyola |
---|---|
slide.bs.ekyuma ekiyitibwa carousel | Ekintu kino kikuba amangu ddala nga slide enkola y'ekyokulabirako eyitibwa. |
ekiseeyeeya.bs.carousel | Ekintu kino kikubwa nga carousel emalirizza enkyukakyuka yaayo eya slide. |