Target
Make a carousel diagram with 5 images
Analysis
To make a carousel diagram, you need the following 3 steps:
1, after the page opens, the first picture shows, the rest of the picture, hidden
2, the picture interval 5 seconds to turn the broadcast once
3, to the 5th map back to the 1th sheet
Production
1, after the page opens, the first picture shows, the rest of the picture, hidden:
$ (". BG"). Not (": eq (0)"). Hide ();
2, Interval 5 seconds Carousel:
Var i=0;
$ (function () {
$ (". BG"). Not (": eq (0)"). Hide (); First photo hidden
SetInterval (function () {
i++;
$ (". BG"). EQ (i). Show (); The first picture shows
$ (". BG"). Not (": eq (" +i+ ")"). Hide (); Not the I-picture hidden
},5000);
})
3. Go to the 1th after uploading to the 5th figure:
if (i==5)
{
i=0;
}
"Complete Program"
Var i=0;
$ (function () {
$ (". BG"). Not (": eq (0)"). Hide (); First photo hidden
SetInterval (function () {
i++;
if (i==5)
{
i=0;
}
$ (". BG"). EQ (i). Show (); The first picture shows
$ (". BG"). Not (": eq (" +i+ ")"). Hide (); Not the I-picture hidden
},5000);
})
"Classroom Example" carousel diagram