Carousel
Igice cya sisitemu yo gusiganwa ku magare binyuze mu bintu - amashusho cyangwa amashusho yinyandiko - nka karuseli.
Carousel ni slide yo gusiganwa ku magare binyuze mu ruhererekane rw'ibirimo, yubatswe na CSS 3D ihindura hamwe na JavaScript. Ikorana nuruhererekane rwamashusho, inyandiko, cyangwa ikimenyetso cyihariye. Harimo kandi inkunga kubanza / ubutaha kugenzura n'ibipimo.
Mucukumbuzi aho Page Visibility API ishyigikiwe, karuseli izirinda kunyerera mugihe urubuga rutagaragara kubakoresha (nkigihe iyo tab ya mushakisha idakora, idirishya rya mushakisha ryaragabanutse, nibindi).
Nyamuneka umenye ko karuseli yatewe idashyigikiwe, kandi karuseli muri rusange ntabwo yujuje ubuziranenge bwo kugerwaho.
Ubwanyuma, niba wubaka JavaScript yacu kuva isoko, birasabautil.js
.
Carousels ntabwo ihita isanzwe ibipimo bya slide. Nkibyo, urashobora gukenera gukoresha ibikorwa byingirakamaro cyangwa uburyo bwihariye kugirango ubone ubunini bukwiye. Mugihe karuseli ishyigikira ibyabanje / ubutaha kugenzura n'ibipimo, ntabwo bisabwa neza. Ongeraho kandi uhindure uko ubishaka.
Witondere gushiraho id idasanzwe kuri .carousel
kugenzura kubushake, cyane cyane niba ukoresha karuseli nyinshi kurupapuro rumwe.
Hano karuseli ifite amashusho gusa. Reba ahari ibishusho bya .d-block
karuseli .img-fluid
kugirango wirinde gushakisha amashusho adasanzwe.
<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>
Ongeraho mubigenzurwa byabanjirije nibikurikira:
<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>
Urashobora kandi kongeramo ibipimo kuri karuseli, hamwe nubugenzuzi, nabwo.
<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>
Ikintu cyambere gikenewe gisabwa
Icyiciro .active
gikeneye kongerwaho imwe mumashusho. Bitabaye ibyo, karuseli ntizagaragara.
Ongeraho ibisobanuro kuri slide yawe byoroshye hamwe .carousel-caption
nibintu muri byose .carousel-item
. Birashobora guhishwa byoroshye kubireba bito, nkuko bigaragara hano hepfo, hamwe nibikorwa byingirakamaro . Turabahisha ubanza hamwe .d-none
no kubagarura kubikoresho biciriritse hamwe .d-md-block
.
Koresha ibiranga amakuru kugirango ugenzure byoroshye umwanya wa karuseli. data-slide
yemera ijambo ryibanze prev
cyangwa next
, rihindura umwanya uhagaze ugereranije nubu. Ubundi, koresha data-slide-to
kunyuza urutonde rwibanze kuri karuseli data-slide-to="2"
, ihinduranya umwanya uhagaze kumurongo runaka utangirana na 0
.
Ikiranga data-ride="carousel"
gikoreshwa mukuranga karuseli nka animasiyo itangirira kurupapuro. Ntishobora gukoreshwa ifatanije na (kurenza kandi bitari ngombwa) JavaScript itangizwa ya karuseli imwe.
Hamagara karuseli intoki hamwe na:
Amahitamo arashobora kunyuzwa kumurongo wamakuru cyangwa JavaScript. Kubiranga Ibyatanzwe, Ongeraho Ihitamo Izina Kuri data-
, Nka Muri data-interval=""
.
Izina | Andika | Mburabuzi | Ibisobanuro |
---|---|---|---|
intera | umubare | 5000 | Ingano yigihe cyo gutinda hagati yizunguruka yikintu. Niba ari ibinyoma, karuseli ntabwo izahita izunguruka. |
Mwandikisho | boolean | ni ukuri | Niba karuseli igomba kwitwara kubyabaye kuri clavier. |
hagarara | umugozi | boolean | "hover" | Niba byashyizweho Ku bikoresho bifasha gukoraho, mugihe byashizweho |
kugendera | umugozi | ibinyoma | Autoplays karuseli nyuma yumukoresha intoki azunguruka ikintu cya mbere. Niba "karuseli", autoplays karuseli kumuzigo. |
gupfunyika | boolean | ni ukuri | Niba karuseli igomba kuzunguruka ubudasiba cyangwa ifite guhagarara gukomeye. |
Uburyo butajegajega ninzibacyuho
Inzira zose za API ntizihuza kandi zitangira inzibacyuho . Basubira kumuhamagara mugihe inzibacyuho itangiye ariko itararangira . Mubyongeyeho, uburyo bwo guhamagarira ibice byinzibacyuho bizirengagizwa .
Itangiza karuseli hamwe nuburyo bwo guhitamo object
hanyuma igatangira gusiganwa ku magare binyuze mubintu.
Amagare anyuze muri karuseli kuva ibumoso ugana iburyo.
Hagarika karuseli gusiganwa ku magare binyuze mu bintu.
Kuzenguruka karuseli kumurongo runaka (0 ishingiye, isa na array). Garuka kumuhamagara mbere yuko intego yerekanwe (ni ukuvuga mbere yuko slid.bs.carousel
ibyabaye biba).
Amagare ku kintu kibanziriza iki. Garuka kumuhamagara mbere yikintu cyabanjirije cyerekanwe (ni ukuvuga mbere yuko slid.bs.carousel
ibyabaye biba).
Amagare ku kintu gikurikira. Garuka kumuhamagara mbere yikintu gikurikira cyerekanwe (ni ukuvuga mbere yuko slid.bs.carousel
ibyabaye biba).
Gusenya ikintu cya karuseli.
Bootstrap ya karuseli yerekana ibintu bibiri byo guhuza imikorere ya karuseli. Ibyabaye byombi bifite imitungo yinyongera ikurikira:
direction
: Icyerekezo karuseli iranyerera (haba"left"
cyangwa"right"
).relatedTarget
: Ikintu cya DOM kirimo kunyerera ahantu nkibintu bikora.from
: Ironderero ryikintu kirihoto
: Ironderero ryikintu gikurikira
Ibintu byose bya karuseli birasa kuri karuseli ubwayo (ni ukuvuga kuri <div class="carousel">
).
Ubwoko bwibyabaye | Ibisobanuro |
---|---|
slide.bs.carousel | Ibirori birasa ako kanya mugihe slide urugero rwakoreshejwe. |
slide.bs.carousel | Ibirori birukanwa mugihe karuseli yarangije kunyerera. |