Carousel
Our Carousel is a robust and versatile component that can be an image slider, to an item carousel, to an onboarding experience. It is touch enabled making it especially smooth to use on mobile.
Note: This is also touch compatible! Try swiping with your finger to scroll through the carousel.
<div class="carousel framed-items">
<a class="carousel-item" href="#one!"><img src="imgs/slider/slider-01.jpg"></a>
<a class="carousel-item" href="#two!"><img src="imgs/slider/slider-02.jpg"></a>
<a class="carousel-item" href="#three!"><img src="imgs/slider/slider-03.jpg"></a>
<a class="carousel-item" href="#four!"><img src="imgs/slider/slider-04.jpg"></a>
<a class="carousel-item" href="#five!"><img src="imgs/slider/slider-05.jpg"></a>
<a class="carousel-item" href="#six!"><img src="imgs/slider/slider-06.jpg"></a>
</div>
jQuery Plugin Initialization
$(document).ready(function(){
$('.carousel').carousel();
});
jQuery Plugin Options
Option Name | Description |
---|---|
duration | Transition duration in milliseconds. (Default: 200) |
dist | Perspective zoom. If 0, all items are the same size. (Default: -100) |
shift | Set the spacing of the center item. (Default: 0) |
padding | Set the padding between non center items. (Default: 0) |
fullWidth | Make the carousel a full width slider like the second example. (Default: false) |
indicators | Set to true to show indicators. (Default: false) |
noWrap | Don't wrap around and cycle through items. (Default: false) |
jQuery Plugin Methods
We have methods to pause, start, move to next and move to previous slide.
// Next slide
$('.carousel').carousel('next');
$('.carousel').carousel('next', 3); // Move next n times.
// Previous slide
$('.carousel').carousel('prev');
$('.carousel').carousel('prev', 4); // Move prev n times.
// Set to nth slide
$('.carousel').carousel('set', 4);
// Destroy carousel
$('.carousel').carousel('destroy');
Full Width Slider
Our carousel has a full width option that makes it into a simple and elegant image carousel. You can also have indicators that show up on the bottom of the slider.
Note: This is also touch compatible! Try swiping with your finger to scroll through the carousel.
<div class="carousel carousel-slider">
<a class="carousel-item" href="#one!"><img src="imgs/slider/slider-full-01.jpg"></a>
<a class="carousel-item" href="#two!"><img src="imgs/slider/slider-full-02.jpg"></a>
<a class="carousel-item" href="#three!"><img src="imgs/slider/slider-full-03.jpg"></a>
<a class="carousel-item" href="#four!"><img src="imgs/slider/slider-full-04.jpg"></a>
</div>
$('.carousel.carousel-slider').carousel({fullWidth: true});
Special Options
The carousel doesn't only support images but also allows you to make content carousels. You can add fixed items to your carousel by adding a div with the class carousel-fixed-item
and adding your fixed content in there.
Note: This is also touch compatible! Try swiping with your finger to scroll through the carousel.
<div class="carousel carousel-slider center" data-indicators="true">
<div class="carousel-fixed-item center">
<a class="btn waves-effect white grey-text darken-text-2">button</a>
</div>
<div class="carousel-item red white-text" href="#one!">
<h2 class="white-text">First Panel</h2>
<p class="white-text">This is your first panel</p>
</div>
<div class="carousel-item amber white-text" href="#two!">
<h2 class="black-text">Second Panel</h2>
<p class="black-text">This is your second panel</p>
</div>
<div class="carousel-item green white-text" href="#three!">
<h2 class="white-text">Third Panel</h2>
<p class="white-text">This is your third panel</p>
</div>
<div class="carousel-item blue white-text" href="#four!">
<h2 class="white-text">Fourth Panel</h2>
<p class="white-text">This is your fourth panel</p>
</div>
</div>
$('.carousel.carousel-slider').carousel({fullWidth: true});
For more detailed informations please visit: http://materializecss.com/carousel.html