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.

<div id= "Mycarousel" class= "Carousel Slide" > <!--Carousel (Carousel) Indicator--<ol class= "Carousel-indicators" &        Gt <li data-target= "#myCarousel" data-slide-to= "0" class= "active" ></li> <li data-target= "#myCarousel" D       ata-slide-to= "1" ></li> <li data-target= "#myCarousel" data-slide-to= "2" ></li> </ol>            <!--Carousel (Carousel) Items--<div class= "Carousel-inner" > <div class= "Item Active" >  </div> <div class= "Item" >  </div> &lt ;d IV class= "Item" >  </di V> </div> <!--carousel (Carousel) nav-<a class= "Carousel-control left" href= "#myCarousel" D Ata-slide= "PREV ">&lsaquo;    </a> <a class= "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 ({      interval:3000    });});

If the settings do not play automatically, you can also:

$ (' #myCarousel '). Carousel ({    pause:true,    interval: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.