Carousel
O se vaega fa'ata'ita'i mo le ta'amilosaga i elemene—ata po'o fa'ase'e o tusitusiga—pei o se carousel.
O le carousel o se faʻataʻitaʻiga mo le uila e ala i se faasologa o anotusi, fausia i le CSS 3D transforms ma sina JavaScript. E galue i se faasologa o ata, tusitusiga, poʻo faʻailoga masani. E aofia ai foʻi le lagolago mo faʻatonuga muamua / sosoʻo ma faʻailoga.
I su'esu'ega o lo'o lagolagoina ai le Itulau Visibility API , o le carousel o le a 'alofia le fa'ase'e pe a le va'aia e le tagata fa'aoga le itulau i luga ole laiga (pei o le taimi e le gaioi ai le itulau su'esu'e, fa'aitiitia le fa'amalama o le su'esu'ega, ma isi).
Fa'amolemole ia nofouta e le'o lagolagoina fo'i ta'avale faga, ma e masani fo'i ona le ogatasi ma ta'iala fa'aoga.
I le mea mulimuli, afai o loʻo e fausiaina la matou JavaScript mai le puna, e manaʻomiautil.js
.
E le otometi ona fa'avasega e ta'avale fa'ase'e fua. E pei o lea, atonu e te manaʻomia le faʻaogaina o mea faʻaoga faaopoopo poʻo sitaili masani e faʻatatau i le tele o mea. A'o lagolagoina e carousels pulega ma fa'ailoga muamua/so'o mai, e le'o mana'omia manino. Fa'aopoopo ma fa'avasega pe a e mana'o e fetaui.
Ia mautinoa e seti se id tulaga ese i luga o le .carousel
mo le fa'atonuga, aemaise lava pe a e fa'aogaina le tele o carousels i luga o le itulau e tasi.
O le carousel lea e na'o fa'ase'e. Fa'ailoa le iai o ata .d-block
ma .img-fluid
luga o le carousel e taofia ai le fa'aogaina o ata o le browser.
<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>
Faʻaopoopo i le pule muamua ma le isi:
<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>
E mafai fo'i ona e fa'aopoopo fa'ailoga ile carousel, fa'atasi ma fa'atonuga.
<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>
Manaomia le elemene galue muamua
E .active
tatau ona fa'aopoopo le vasega i se tasi o fa'ata'ita'iga. A leai, o le a le mafai ona iloa le carousel.
Fa'aopoopo fa'amatalaga i au fa'ase'e faigofie ma le .carousel-caption
elemene i totonu o so'o se .carousel-item
. E mafai ona faigofie ona natia i luga o vaʻaiga laiti, e pei ona faʻaalia i lalo, faʻatasi ai ma mea faʻaoga faʻaalia . Matou te nanaina muamua .d-none
ma toe aumai i luga o masini lapopoa ma .d-md-block
.
Fa'aoga uiga fa'amaumauga e faigofie ai ona pulea le tulaga o le carousel. data-slide
talia upu autu prev
po'o next
, lea e suia ai le tulaga fa'ase'e fa'atatau i lona tulaga o iai nei. I le isi itu, fa'aaoga data-slide-to
e pasi ai se fa'ailoga fa'ase'e mata'utia i le carousel data-slide-to="2"
, lea e sui ai le tulaga fa'ase'e i se fa'ailoga fa'apitoa e amata i le 0
.
O le data-ride="carousel"
uiga e fa'aoga e fa'ailoga ai se carousel e fa'aola e amata ile utaina o itulau. E le mafai ona fa'aogaina fa'atasi ma (e le toe mana'omia) fa'amatagofie le JavaScript o le carousel e tasi.
Valaau ma le lima le carousel ma:
O filifiliga e mafai ona pasia e ala i faʻamatalaga uiga poʻo le JavaScript. Mo fa'amatalaga uiga, fa'aopoopo le igoa filifiliga i le data-
, pei o le data-interval=""
.
Igoa | Ituaiga | Fa'atonu | Fa'amatalaga |
---|---|---|---|
vaeluaga | numera | 5000 | Le aofa'i o le taimi e fa'atuai ai i le va o le ta'avale otometi se mea. Afai e sese, e le otometi le taamilomilo o le carousel. |
piano | boolean | moni | Pe tatau ona tali atu le carousel i mea e tutupu i le keyboard. |
taofi | manoa | boolean | "faapepa" | Afai e seti i le I luga o masini e mafai ona pa'i, pe a seti i le |
tietie | manoa | pepelo | Ta'alo otometi le carousel pe a uma ona fa'ata'amilo lima le tagata fa'aoga le mea muamua. Afai o le "carousel", e ta'alo otometi le carousel i luga o le uta. |
afifi | boolean | moni | Pe tatau ona fa'aauau le ta'amilosaga o le ta'amilosaga pe fa'agata fo'i. |
Metotia ma suiga e le tutusa
O metotia API uma e le fetaui ma amata se suiga . Latou te toe fo'i atu i le tagata telefoni i le taimi lava e amata ai le suiga ae le'i uma . E le gata i lea, o le a le amanaʻiaina se auala e valaʻau ai i se vaega o suiga .
Fa'amataina le carousel i se filifiliga e filifili object
ma amata ai le uila i mea.
Taamilomilo i aitema carousel mai le agavale i le taumatau.
Taofi le carousel mai le tietie uila i aitema.
Ta'amilomilo le carousel i se fa'avaa fa'apitoa (fa'avae 0, pei o se fa'asologa). Toe fo'i i le tagata vala'au a'o le'i fa'aalia le mea fa'atatau (fa'atusa a'o le'i tupu le slid.bs.carousel
mea na tupu).
Ta'amilosaga i le mea muamua. Toe fo'i i le tagata vala'au a'o le'i fa'aalia le mea muamua (fa'atusa a'o le'i tupu le slid.bs.carousel
mea na tupu).
Taamilo i le isi mea. Toe fo'i i le tagata vala'au a'o le'i fa'aalia le isi aitema (fa'atusa a'o le'i tupu le slid.bs.carousel
mea na tupu).
Fa'aleagaina le carousel o se elemene.
O le vasega carousel a Bootstrap o lo'o fa'aalia ai mea e lua mo le fa'aogaina o galuega fa'aoga. O mea tutupu uma e lua e iai mea fa'aopoopo nei:
direction
: Le itu o lo'o fa'ase'e ai le carousel ("left"
po'o le"right"
).relatedTarget
: O le elemene DOM o loʻo faʻasolo i totonu o le mea o loʻo galue.from
: Le faasino igoa o le mea o iai neito
: Le faasino igoa o le mea e sosoo ai
O mea uma e tutupu i le carousel e fa'amu i le carousel lava ia (ie i le <div class="carousel">
).
Ituaiga Mea | Fa'amatalaga |
---|---|
slide.bs.carousel | E mu vave lenei mea pe a fa'aogaina le slide auala fa'ata'ita'i. |
slid.bs.carousel | E fa'amu lenei mea pe a mae'a le fa'ase'esega fa'ase'e o le carousel. |