Kaarooseelii
Qaama agarsiisa islaayidii elementoota keessa naanna'uuf-fakkiiwwan ykn islaayidoota barruu-akka kaarooseelii.
Akkaataa itti hojjetu
Kaarooseeliin agarsiisa islaayidii qabiyyee tartiiba keessa marsaa, jijjiirraa CSS 3D fi xiqqoo JaavaScriptiin ijaaramedha. Fakkiiwwan, barruu, ykn mallattoo amala walduraa duubaan hojjetaman waliin hojjeta. Akkasumas deeggarsa to’annoo fi agarsiistota duraanii/itti aananiif of keessatti qabata.
Biraawuzaroota bakka APIn Mul'achuu Fuulaa deeggarame keessatti, yeroo fuul-barruun fayyadamaaf hin mul'anne (kan akka yeroo caancala biraawzari sochii hin qabne, foddaan biraawzari xiqqaate fi kkf) karooseeliin akka hin lilmoo'u ni taasisa.
prefers-reduced-motion
gaaffii miidiyaa irratti hundaa'a. Kutaa sochii hir'ate sanada dhaqqabummaa keenyaa ilaali
.
Maaloo beekaa, kaarooseloonni man'ee qaban akka hin deeggaramne, akkasumas kaarooseloonni akka waliigalaatti ulaagaalee dhaqqabummaa wajjin kan wal hin simne.
Dhumarratti, yoo JavaScriptutil.js
keenya madda irraa ijaaraa jirta ta'e, .
Fakkeenya
Kaarooseelonni ofumaan safara islaayidii hin normalize godhan. Akka kanaan, qabiyyee sirritti safaruuf faayidaa dabalataa ykn akkaataa amala fayyadamuu si barbaachisuu danda'a. Carousels too'annoo fi agarsiistota duraanii/itti aanan yoo deeggaran, ifatti hin barbaachisan. Akka barbaaddanitti itti dabalaa fi dhuunfachiisi.
Kutaan .active
islaayidoota keessaa tokkotti dabalamuu qaba yoo kana hin taane karooseeliin hin mul'atu. id
Akkasumas too'annoo filannoof kan irratti addaa saaguu mirkaneessi .carousel
, keessumaa yoo fuula tokko irratti kaarooseelii hedduu fayyadamaa jirta ta'e. Qaamonni too'annoo fi agarsiiftuu data-target
amalli (ykn href
walqabsiisotaaf) kan kan qaamaa wajjin walsimu qabaachuu id
qabu .carousel
.
Islaayidoota qofa
Kunoo carousel kan islaayidii qofa qabu. Hiriirsa fakkii durtii biraawzari ittisuuf argamaa .d-block
fi fakkiiwwan kaarooseelii irratti hubadhu..w-100
<div id="carouselExampleSlidesOnly" class="carousel slide" data-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>
To'annoo waliin
To'annoo duraa fi itti aanu keessatti dabaluu. Qaamolee fayyadamuu ni gorsina , garuu elementoota waliin <button>
fayyadamuu dandeessa .<a>
role="button"
<div id="carouselExampleControls" class="carousel slide" data-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-target="#carouselExampleControls" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-target="#carouselExampleControls" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</button>
</div>
Agarsiistota waliin
Akkasumas agarsiistota gara karooseeliitti dabaluu dandeessa, too'annoowwan cinatti, akkasumas.
<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 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-target="#carouselExampleIndicators" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-target="#carouselExampleIndicators" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</button>
</div>
Barreeffamoota mata duree waliin
.carousel-caption
Qabeentaa kamiyyuu keessa jiruun salphaatti islaayidoota kee irratti barruulee dabali .carousel-item
. Isaan salphaatti buufatawwan ilaalchaa xixiqqoo irratti dhokfamuu danda'u, akkuma armaan gadiitti, faayidaa agarsiisa filannoo wajjin . Jalqaba .d-none
irratti dhokfnee meeshaalee giddu galeessaa irratti .d-md-block
.
<div id="carouselExampleCaptions" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleCaptions" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleCaptions" data-slide-to="1"></li>
<li data-target="#carouselExampleCaptions" data-slide-to="2"></li>
</ol>
<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-target="#carouselExampleCaptions" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-target="#carouselExampleCaptions" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</button>
</div>
Qaxxaamuraa
.carousel-fade
Islaayidoota islaayidii osoo hin taane ce'umsa fade waliin sochoosuuf karooseelii kee irratti dabali . Qabiyyee kaarooseelii kee irratti hundaa'uun (fkn, islaayidoota barruu qofa), qaxxaamuraa sirrii ta'eef .bg-body
CSS amala tokko tokko s irratti dabaluu barbaadda ta'a ..carousel-item
<div id="carouselExampleFade" class="carousel slide carousel-fade" data-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-target="#carouselExampleFade" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-target="#carouselExampleFade" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</button>
</div>
.carousel-item
Gidduu-galeessa dhuunfaa
Yeroo ofumaan gara wanta itti aanutti marsaa gidduutti harkifannaa jijjiiruuf gara data-interval=""
atti dabali ..carousel-item
<div id="carouselExampleInterval" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active" data-interval="10000">
<img src="..." class="d-block w-100" alt="...">
</div>
<div class="carousel-item" data-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-target="#carouselExampleInterval" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-target="#carouselExampleInterval" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</button>
</div>
Tuttuqaa swiping hanqisi
Carousels meeshaalee touchscreen irratti bitaa/mirga swiping gochuun islaayidoota gidduutti socho'uu ni deeggaru. data-touch
Kunis amaloota fayyadamuun hanqisuun ni danda'ama . Fakkeenyi armaan gadii akkasumas amallicha hin dabalatu data-ride
akkasumas qaba data-interval="false"
kanaaf ofumaan hin taphatu.
<div id="carouselExampleControlsNoTouching" class="carousel slide" data-touch="false" data-interval="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-target="#carouselExampleControlsNoTouching" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-target="#carouselExampleControlsNoTouching" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</button>
</div>
Fayyadama
Karaa amaloota deetaa
Bakka kaarooseelii salphaatti to'achuuf amaloota deetaa fayyadami. data-slide
jechoota furtuu prev
ykn next
, kan iddoo islaayidii bakka ammaa isaa wajjin walqabatee jijjiira. data-slide-to
Akka filannootti, indeeksii islaayidii raw gara karooseeliitti dabarsuudhaaf fayyadami data-slide-to="2"
, kunis iddoo islaayidii gara indeeksii murtaa'aa dhaan jalqabutti jijjiira 0
.
Amalli data-ride="carousel"
karooseelii akka sochoosuutti fe'iinsa fuula irraa eegalee mallattoo itti gochuuf fayyadama. Yoo data-ride="carousel"
carousel kee initialize gochuuf hin fayyadamne ofuma kee initialize gochuu qabda. Innis (barbaachisaa fi hin barbaachifne) ifatti JaavaScript jalqabbii karooseelii walfakkaataa wajjin walitti makuun fayyadamuu hin danda'u.
Karaa JaavaScript
Carousel harkaan bilbili:
$('.carousel').carousel()
Filannoowwan
Filannoon karaa amaloota deetaa ykn JaavaScript darbuu danda'u. Amaloota deetaatiif, maqaa filannoo gara data-
, akkuma keessatti dabali data-interval=""
.
Maqaa | Akaakuu | Durtii dha | Ibsa |
---|---|---|---|
gidduugaleessaa | lakkoofsa | 5000 ta'a | Hamma yeroo meeshaa tokko ofumaan marsaa gidduutti harkifachuu qabu. Yoo false , carousel ofumaan hin marsaa. |
kiiboordii | boolee | dhugaa | Karooseeliin taateewwan kiiboordii irratti deebii kennuu qabaachuu fi dhiisuu isaa. |
gidduutti dhaabuu | tarree | boolee | 'hover' jedhu. | Yoo gara tti saagame Meeshaalee tuqaan dandeessisan irratti, yeroo gara tti saagamu |
oofuu | hidhaa | soba | Fayyadamaan wanta jalqabaa harkaan erga naanna'ee booda karooseelii ofumaan taphachiisa. Yoo gara tti qindaa'e 'carousel' , karooseelii fe'amuu irratti ofumaan taphachiisa. |
itti maruu | boolee | dhugaa | Kaarooseelichi marsaa itti fufiinsaan deemuu qaba moo dhaabbannaa cimaa qabaachuu qaba. |
tuquu | boolee | dhugaa | Kaarooseeliin meeshaalee iskiriinii tuqaalee irratti walqunnamtii bitaa/mirgaa swipe deeggaru qabaachuu fi dhiisuu isaa. |
Malawwan
Malawwanii fi ce’umsawwan wal hin simne
Malleen API hundi wal hin simnee fi ce'umsa jalqabu . Akkuma ce'umsi jalqabame garuu osoo hin xumuramin gara nama bilbileetti deebi'u . Dabalataan, waamichi malaa qaama ce'umsaa irratti ni tuffatama .
.carousel(options)
Filannoo filannoo ta'een kaarooseelii jalqabsiisee object
meeshaalee keessaa biskileetii jalqaba.
$('.carousel').carousel({
interval: 2000
})
.carousel('cycle')
Meeshaalee karooseelii keessaa bitaa gara mirgaatti marsaa.
.carousel('pause')
Kaarooseeliin meeshaalee keessa akka hin biskileetii hin deemne ni dhaaba.
.carousel(number)
Kaarooseelii gara furtuu murtaa'etti marsaa (0 irratti hundaa'e, tarree wajjin wal fakkaata). Wanti galmee osoo hin agarsiifamiin dura gara waamichaatti deebi'a (jechuunis osoo slid.bs.carousel
taatee hin uumamin dura).
.carousel('prev')
Gara wanta duraatti marsaa. Wanti duraanii osoo hin agarsiifamiin dura (jechuunis slid.bs.carousel
taatee osoo hin uumamin dura) gara waamichaatti deebi'a.
.carousel('next')
Gara wanta itti aanutti marsaa. Wanti itti aanu osoo hin agarsiifamiin dura (jechuunis slid.bs.carousel
taatee osoo hin uumamin dura) gara waamichaatti deebi'a.
.carousel('dispose')
Karooseelii elementii tokkoo ni balleessa.
.carousel('nextWhenVisible')
Yeroo fuul-barruun hin mul'anne ykn karooseeliin ykn warri isaa hin mul'annetti karooseelicha gara itti aanutti hin marsaa. Wanti itti aanu osoo hin agarsiifamiin dura (jechuunis slid.bs.carousel
taatee osoo hin uumamin dura) gara waamichaatti deebi'a.
.carousel('to')
Kaarooseelii gara furtuu murtaa'etti marsaa (0 irratti hundaa'e, tarree wajjin wal fakkaata). Wanti itti aanu osoo hin agarsiifamiin dura (jechuunis slid.bs.carousel
taatee osoo hin uumamin dura) gara waamichaatti deebi'a.
Taateewwan
Bootstrap's carousel class taateewwan lama hooking gara dalagaa carousel saaxila. Taateewwan lamaan amaloota dabalataa armaan gadii qabu:
direction
: Kallattii kaarooseelichi itti lilmoo’u (yookaan"left"
ykn"right"
).relatedTarget
: Qaama DOM kan akka wanta socho'aa ta'ee bakkatti siqsaa jiru.from
: Indeeksii wanta ammaato
: Indeeksii wanta itti aanuu
Taateewwan kaarooseelii hundi karooseelicha mataa isaa irratti (jechuunis <div class="carousel">
) irratti dhukaafamu.
Gosa Taatee | Ibsa |
---|---|
islaayidii.bs.kaarooseelii | Taatee kun yeroo slide mala fakkeenyaa waamamu battalumatti dhukaasa. |
slid.bs.kaarooseelii | Taatee kun kan dhukaafamu yeroo kaarooseeliin ce'umsa islaayidii isaa xumurudha. |
$('#myCarousel').on('slide.bs.carousel', function () {
// do something...
})
Yeroo ce'umsaa jijjiiri
Yeroon ce'umsaa kan jijjiiramaa Sass qindeessuu dura ykn akkaataa amala yoo CSS qindaa'e fayyadamaa jirta ta'e .carousel-item
waliin jijjiiramuu danda'a . $carousel-transition
Yoo ce'umsi dachaa hojiirra oole, ce'umsi jijjiirraa dursee akka ibsame mirkaneessi (fkn. transition: transform 2s ease, opacity .5s ease-out
).