The Bootstrap Carousel (Carousel) plugin is a flexible, responsive way to add sliders to your site. In addition, the content is flexible enough to be an image, inline frame, video, or whatever type of content you want to place.
If you want to reference the functionality of the plug-in separately, you need to reference carousel.js. Or, as mentioned in the Bootstrap Plugin Overview chapter, you can refer to the bootstrap.js or compressed version of Bootstrap.min.js.
Here is a simple slide, using the Bootstrap Carousel (Carousel) plug-in to display a generic component of a looping play element. To implement Carousel, you only need to add code with that tag. You do not need to use the Data property, just a simple class-based development.
<DivID= "Mycarousel"class= "Carousel Slide"> <!--Carousel (Carousel) Indicator - <olclass= "Carousel-indicators"> <LiData-target= "#myCarousel"data-slide-to= "0"class= "Active"></Li> <LiData-target= "#myCarousel"data-slide-to= "1"></Li> <LiData-target= "#myCarousel"data-slide-to= "2"></Li> </ol> <!--Carousel (Carousel) Project - <Divclass= "Carousel-inner"> <Divclass= "Item Active"> <imgsrc= "/wp-content/uploads/2014/07/slide1.png"alt= "First Slide"> </Div> <Divclass= "Item"> <imgsrc= "/wp-content/uploads/2014/07/slide2.png"alt= "Second Slide"> </Div> <Divclass= "Item"> <imgsrc= "/wp-content/uploads/2014/07/slide3.png"alt= "Third Slide"> </Div> </Div> <!--Carousel (Carousel) Navigation - <aclass= "Carousel-control Left"href= "#myCarousel"Data-slide= "Prev">‹ </a> <aclass= "Carousel-control Right"href= "#myCarousel"Data-slide= "Next">› </a></Div>
In addition to the issue of carousel components can not be automatically played, here are a few questions to note:
1, the first part of attention is data-ride= "Carousel"
Using the bootstrap Carousel component by default, you can automatically play it by adding data-ride= "Carousel". You do not need to use the initialized JS function. So, if Carousel doesn't play automatically, check this section first. Other parameters can be added here, such as the time interval to set the rotation of the image.
Code: <div id= "Mycarousel" class= "Carousel Slide" data-ride= "Carousel " data-interval= ">"
2, in fact, there are manual initialization of the Carousel component method
This method is used in bootstrap 2.x, when the data-ride= "Carousel" method is used, it can be initialized manually. The code is as follows:
$ (' #myCarousel '). Carousel ();
If you still want to control the time interval for the rotation of the image, there are parameters:
$ (function() { $ (' #myCarousel '). Carousel ({ });});
If the settings do not play automatically, you can also:
$ (' #myCarousel '). Carousel ({ true, false});
Reference:
Http://www.runoob.com/bootstrap/bootstrap-carousel-plugin.html
The Carousel of Bootstrap