Carousel
Qayb ka mid ah bandhigyada slideshow ee baaskiilka lagu dhex wado canaasirta-sawirrada ama sawirada qoraalka-sida carousel-ka.
Sida ay u shaqeyso
Carouselku waa sawir-qaade loogu talagalay baaskiil wadista iyada oo loo marayo taxane taxane ah, oo lagu dhisay isbeddellada CSS 3D iyo xoogaa JavaScript ah. Waxay la shaqaysaa sawirro taxane ah, qoraal, ama calaamadayn gaar ah. Waxa kale oo ka mid ah taageerada kontaroolada hore/xiga iyo tilmaamayaasha.
Barowsarrada halka laga taageero Page Visibility API , carouselku wuxuu iska ilaalin doonaa simbiriirixinta marka bogga mareegaha uusan u muuqan isticmaaluhu (sida marka tabka browserku aanu shaqayn, daaqada browserka waa la yareeyey, iwm.).
Saamaynta animation ee qaybtani waxay ku xidhan tahay prefers-reduced-motion
waydiinta warbaahinta. Eeg qaybta dhaqdhaqaaqa la dhimay ee dukumeenti gelitaankeena .
Fadlan la soco in carousels buul leh aan la taageerin, iyo carousels guud ahaan ma waafaqsana heerarka gelitaanka.
Ugu dambeyntii, haddii aad ka dhisayso JavaScript-kayaga isha, waxay u baahan tahayutil.js
.
Tusaale
Carousels si toos ah uma caadiyeeyaan cabbirrada slide. Sidan oo kale, waxaa laga yaabaa inaad u baahato inaad isticmaasho yutiilitida dheeraadka ah ama qaababka gaarka ah si aad u cabbirto nuxurka saxda ah. Halka carousels ay taageerto kontaroolada hore/xiga iyo tilmaamayaasha, si cad looguma baahna. Ku dar oo habbee sida aad ku habboon tahay.
Fasalka .active
wuxuu u baahan yahay in lagu daro mid ka mid ah boggaga haddii kale carouselku ma muuqan doono. Sidoo kale iska hubi inaad dejiso id gaar ah .carousel
kantaroolka ikhtiyaariga ah, gaar ahaan haddii aad isticmaaleyso carousels badan hal bog. Cunsurada xakamaynta iyo tilmaamuhu waa inay lahaadaan data-target
sifo (ama href
xidhiidhinta) u dhigma id ee .carousel
curiyaha.
Islaaydh kaliya
Halkan waxaa ah carousel oo leh sawirro kaliya. Ogsoonow joogitaanka .d-block
iyo .w-100
sawirada carouselka si aad uga hortagto toosinta sawirka browserka.
Xakamaynta
Ku darida kontarooladii hore iyo kan xiga:
Iyadoo tilmaamayaasha
Waxa kale oo aad ku dari kartaa tilmaamayaasha carouselka, oo ay weheliyaan kontaroolada, sidoo kale.
Qoraalo wata
Ku dar qoraallada boggagaaga si fudud oo leh .carousel-caption
curiyaha ku jira mid kasta .carousel-item
. Waxay si fudud loogu qarin karaa daawashada yaryar, sida hoos ku cad, oo leh qalab bandhig oo ikhtiyaari ah . Waanu ku qarinaa marka hore oo aanu .d-none
ku soo celinaa aaladaha dhexdhexaadka ah ee leh .d-md-block
.
Isgoysyada
Ku darso .carousel-fade
carouselkaaga si aad u nooleeyso sawiro leh isbedel libdhaya halkii aad ka saari lahayd.
.carousel-item
Dhexdhexaad shaqsiyeed
Ku dar data-interval=""
a .carousel-item
si aad u bedesho qadarka wakhtiga dib u dhigista inta u dhaxaysa si toos ah baaskiil wadida ilaa shayga xiga.
Isticmaalka
Iyada oo loo marayo sifooyinka xogta
Isticmaal sifada xogta si aad si fudud u xakamayso booska carouselka. data-slide
aqbala ereyada furaha prev
ama next
, kaas oo beddela booska slide marka loo eego booska uu hadda joogo. Haddii kale, isticmaal data-slide-to
si aad u gudbiso tusmaynta slide ceeriin ee carousel data-slide-to="2"
, kaas oo u beddelaya booska slide tusme gaar ah oo ka bilaabmaya 0
.
Sifada data-ride="carousel"
waxa loo isticmaalaa in lagu calaamadiyo carousel-ka sida firfircoon ee ka bilaabmaya culayska bogga. Haddii aadan isticmaalin data-ride="carousel"
inaad ku bilawdo carouselkaaga, waa inaad adigu bilawdaa. Looma isticmaali karo marka lagu daro (kaadiraan iyo aan loo baahnayn) bilawga JavaScript cad ee isla carouselka.
Iyadoo loo marayo JavaScript
Si gacanta ah ula wac carousel:
Ikhtiyaarada
Ikhtiyaarada waxaa lagu gudbi karaa sifada xogta ama JavaScript. Sifooyinka xogta, ku dheji magaca ikhtiyaarka data-
, sida ku jira data-interval=""
.
Magaca | Nooca | Asal ahaan | Sharaxaada |
---|---|---|---|
dhexda | tirada | 5000 | Qadarka wakhtiga dib u dhigista udhaxaysa si toos ah shay baaskiil wadida. Haddii ay been tahay, carousel si toos ah uma wareegeyso. |
kiiboodhka | booliyan | run | Haddii carouselku uu ka falcelinayo dhacdooyinka kiiboodhka. |
hakad | xadhig | booliyan | "hoos u dhac" | Haddii la dejiyo Aaladaha taabanaya, marka lagu |
fuulid | xadhig | been ah | Si otomaatig ah ayey u ciyaareysaa carousel-ka ka dib marka isticmaaluhu uu gacanta ku wareego shayga ugu horreeya. Haddii "carousel", wuxuu si otomaatig ah u ciyaara carousel-ka isagoo raran. |
duub | booliyan | run | Haddii carouselku si joogto ah u wareego ama uu yeesho joogsi adag. |
taabo | booliyan | run | Haddii carouselku uu taageerayo is dhexgalka bidix/midig ee aaladaha shaashadda taabashada ah. |
Hababka
Hababka iyo kala-guurka aan isku midka ahayn
Dhammaan hababka API waa isku mid waxayna bilaabaan kala-guurka . Waxay ku soo noqdaan qofka soo wacaya isla markii uu bilaabmo kala-guurka laakiin ka hor inta uusan dhammaan . Intaa waxaa dheer, hab ku baaqaya in qayb ka beddelka waa la iska indhatiray .
Ka eeg dukumeentiyada JavaScript wixii macluumaad dheeraad ah .
.carousel(options)
Waxay ku bilawday carousel-ka ikhtiyaar ikhtiyaari ah object
oo bilaabay inuu ku dhex wado alaabta.
.carousel('cycle')
Wareegtada dhex mara alaabta carouselka bidix ilaa midig.
.carousel('pause')
Karoosalka ka joojiya in uu baaskiil ku dhex maro alaabta.
.carousel(number)
Wareega karooselka si uu u sameeyo jir gaar ah (0 ku salaysan, oo la mid ah array). Ku soo noqda qofka soo wacay ka hor inta aan la tusin shayga la beegsaday (tusaale ka hor intaanay slid.bs.carousel
dhacdada dhicin).
.carousel('prev')
Wareegto shayga hore Ku soo noqda qofka soo wacay ka hor inta aan shaygii hore la muujin (tusaale ka hor intaanay slid.bs.carousel
dhacdada dhicin).
.carousel('next')
Wareegto shayga xiga Ku soo noqda qofka soo wacay ka hor inta aan shayga xiga la muujin (tusaale ka hor intaanay slid.bs.carousel
dhacdada dhicin).
.carousel('dispose')
Waxay baabi'isaa carousel-ka curiyaha.
Dhacdooyinka
Fasalka carousel ee Bootstrap wuxuu daaha ka qaadaa laba dhacdo oo loogu talagalay in lagu xidho shaqeynta carousel. Labada dhacdoba waxay leeyihiin waxyaabo dheeraad ah oo soo socda:
direction
: Jihada uu carouselku u sii jeedo (ama"left"
ama"right"
).relatedTarget
: Cunsurka DOM ee meesha lagu sibiibi sida shayga firfircoon.from
: Tusmada shayga hadda jirato
: Tusmada shayga xiga
Dhammaan dhacdooyinka carousel-ka waxaa lagu ridaa carouselka laftiisa (ie at the <div class="carousel">
).
Nooca Dhacdada | Sharaxaada |
---|---|
slide.bs.carousel | Dhacdadani waxay isla markiiba gubtaa marka slide habka tusaale ahaan loo yeedho. |
slid.bs.carousel | Dhacdadan waxa la eryaa marka carouselku dhammeeyo kala-guurka slide-ka. |
Beddel muddada kala guurka
Muddada kala-guurka .carousel-item
waxa lagu beddeli karaa $carousel-transition
doorsoomaha Sass ka hor inta aan la ururin ama qaababka caadiga ah haddii aad isticmaalayso CSS-ga la soo ururiyey. Haddii kala-guuro badan la dabaqo, hubi in isbeddelka beddelka la qeexay marka hore (tus. transition: transform 2s ease, opacity .5s ease-out
).