The Carousel of Bootstrap

Source: Internet
Author: User
Tags bootstrap carousel

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">&lsaquo;    </a>    <aclass= "Carousel-control Right"href= "#myCarousel"Data-slide= "Next">&rsaquo;    </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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.