Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Materialize Carousel Slider autoplay

Is there a parameter to make the materialize carousel slider to auto play?

$('.carousel').carousel();

for example (this parameter doesn't work):

$('.carousel').carousel({
   autoplay: true
});

Thank you!

like image 783
Leandro Soriano Avatar asked Apr 12 '16 18:04

Leandro Soriano


2 Answers

I resolved the problem with this:

$('.carousel').carousel({
    padding: 200    
});
autoplay();
function autoplay() {
    $('.carousel').carousel('next');
    setTimeout(autoplay, 4500);
}
like image 51
Leandro Soriano Avatar answered Sep 18 '22 22:09

Leandro Soriano


I resolved the problem with this code:

$('.carousel.carousel-slider').carousel({
   fullWidth: true,
   padding: 200
 }, setTimeout(autoplay, 4500));

 function autoplay() {
   $('.carousel').carousel('next');
   setTimeout(autoplay, 4500);
 }
like image 21
Hugo Gutierrez Avatar answered Sep 20 '22 22:09

Hugo Gutierrez