Carousel
Chikamu chemasiraidhi chekuchovha bhasikoro kuburikidza nezvinhu-mifananidzo kana masiraidhi ezvinyorwa-sekarosi.
Iyo carousel islideshow yekuchovha bhasikoro kuburikidza neyakatevedzana yemukati, yakavakwa neCSS 3D inoshandura uye zvishoma zveJavaScript. Inoshanda neakatevedzana emifananidzo, zvinyorwa, kana tsika markup. Inosanganisirawo kutsigirwa kwezvakapfuura / zvinotevera zvidzoreso uye zviratidzo.
Mumabhurawuza anotsigirwa nePeji Kuonekwa API , iyo carousel inodzivirira kutsvedza kana peji rewebhu risingaonekwe kumushandisi (senge kana iyo browser tab isingashande, hwindo rebrowser rinoderedzwa, nezvimwewo).
Ndapota ziva kuti nested carousels haatsigirwe, uye carousels kazhinji haaenderane neanowanikwa.
Chekupedzisira, kana iwe uchivaka yedu JavaScript kubva kunobva, inodautil.js
.
Carousels haangogadzirisi masiraidhi zviyero. Saka nekudaro, ungangoda kushandisa zvimwe zvinoshandiswa kana masitaera etsika kuti aenzane nehukuru hwemukati. Nepo macarousels achitsigira apfuura / anotevera zvidzoreso uye zviratidzo, hazvidiwe zvakajeka. Wedzera uye gadzirisa sezvaunoona zvakakodzera.
Kirasi .active
inoda kuwedzerwa kune imwe yemasiraidhi zvikasadaro carousel haizoonekwe. Zvakare ita shuwa yekuseta yakasarudzika id pane .carousel
yesarudzo yekudzora, kunyanya kana iwe uchishandisa akawanda carousels pane imwechete peji. Kudzora uye zvinhu zvinoratidzira zvinofanirwa kuve data-target
nehunhu (kana href
hwemalink) hunoenderana neid .carousel
yechinhu.
Heino carousel ine masiraidhi chete. Ziva kuvepo kweiyo .d-block
uye .w-100
pa carousel mifananidzo kudzivirira browser default image alignment.
Kuwedzera mune yapfuura uye inotevera kudzora:
Iwe unogona zvakare kuwedzera zviratidzo kune carousel, padivi pezvinodzora, zvakare.
Wedzera zvinyorwa kune masiraidhi ako zviri nyore nechinhu .carousel-caption
chiri mukati mechero .carousel-item
. Zvinogona kuvanzwa zviri nyore pamadiki ekuona, sezvaratidzwa pazasi, zvine sarudzo yekuratidzira zvishandiso . Tinovavanza pakutanga .d-none
nekuvadzosa pamidziyo yepakati nepakati ine .d-md-block
.
Wedzera .carousel-fade
kucarousel yako kuti urarame masiraidhi neshanduko yakapera pachinzvimbo chesiraidhi.
Shandisa data hunhu kudzora zviri nyore chinzvimbo checarousel. data-slide
inogamuchira mazwi makuru prev
kana next
, iyo inoshandura nzvimbo yemasiraidhi maererano nenzvimbo yayo yazvino. Neimwe nzira, shandisa data-slide-to
kupfuudza siraidhi indekisi ku carousel data-slide-to="2"
, iyo inoshandura nzvimbo yemasiraidhi kuenda kune imwe index inotanga na 0
.
Hunhu data-ride="carousel"
hunoshandiswa kumaka carousel seanorarama kutanga pakurodha peji. Haikwanise kushandiswa musanganiswa ne (zvisina basa uye zvisina basa) zvakajeka JavaScript kutanga kwekarosi imwechete.
Fonera carousel nemaoko ne:
Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-
, semu data-interval=""
.
Zita | Type | Default | Tsanangudzo |
---|---|---|---|
interval | nhamba | 5000 | Huwandu hwenguva yekunonoka pakati pekuita bhasikoro chinhu. Kana nhema, carousel haizongotenderera ichitenderera. |
keyboard | boolean | chokwadi | Kunyangwe iyo carousel inofanirwa kuita kune keyboard zviitiko. |
pause | tambo | boolean | "hovha" | Kana yaiswa kuti Pamidziyo inogonesa kubata, kana yaiswa |
ride | tambo | nhema | Inotamba otomatiki iyo carousel mushure mekunge mushandisi atenderedza chinhu chekutanga. Kana "carousel", inoridza otomatiki iyo carousel iri mutoro. |
wrap | boolean | chokwadi | Kunyangwe iyo carousel inofanirwa kutenderera ichitenderera kana kumira zvakaoma. |
Asynchronous nzira uye shanduko
Yese nzira dzeAPI dzine asynchronous uye dzinotanga shanduko . Vanodzokera kumunhu anenge afona pachangotanga shanduko asi isati yapera . Pamusoro pezvo, kufona kwenzira pachikamu chekuchinja kuchafuratirwa .
Inotanga carousel ine sarudzo yesarudzo object
uye inotanga kuchovha bhasikoro kuburikidza nezvinhu.
Kutenderera nepakati pezvinhu zvecarousel kubva kuruboshwe kuenda kurudyi.
Inomisa carousel kubva kubhasikoro kuburikidza nezvinhu.
Inotenderedza carousel kune imwe furemu (0 yakavakirwa, yakafanana neyakarongwa). Inodzokera kune akafona chinhu chisati charatidzwa (kureva kuti slid.bs.carousel
chiitiko chisati chaitika).
Kutenderera kune chinhu chapfuura. Inodzokera kumunhu anenge afona chinhu chapfuura chisati charatidzwa (kureva kuti slid.bs.carousel
chiitiko chisati chaitika).
Kutenderera kuenda kuchinhu chinotevera. Inodzokera kumunhu arikufona chinhu chinotevera chisati charatidzwa (kureva kuti slid.bs.carousel
chiitiko chisati chaitika).
Inoparadza carousel yechimwe chinhu.
Bootstrap's carousel kirasi inofumura zviitiko zviviri zvekukochekera mukuita kwecarousel. Zviitiko zviviri izvi zvine zvimwe zvinotevera:
direction
: Nzira iyo carousel iri kutsvedza (zvichida"left"
kana"right"
).relatedTarget
: Chinhu cheDOM chiri kutsvedzerwa panzvimbo sechinhu chinoshanda.from
: Indekisi yechinhu chazvinoto
: Indekisi yechinhu chinotevera
Zvese zviitiko zvecarousel zvinodzingwa pacarousel pachayo (kureva pa <div class="carousel">
).
Chiitiko Type | Tsanangudzo |
---|---|
slide.bs.carousel | Ichi chiitiko chinopisa nekukasira kana slide nzira yemuenzaniso yakumbirwa. |
slid.bs.carousel | Ichi chiitiko chinodzingwa kana carousel yapedza shanduko yayo yemasiraidhi. |
Nguva yekushandura .carousel-item
inogona kuchinjwa $carousel-transition
neiyo Sass chinja usati wanyora kana masitaera etsika kana uri kushandisa iyo yakaunganidzwa CSS. Kana shanduko dzakawanda dzikaiswa, ita shuwa kuti shanduko inotsanangurwa kutanga (semuenzaniso. transition: transform 2s ease, opacity .5s ease-out
).