michelle
michelle

Reputation: 303

Bootstrap carousel start autoplay when it scrolls on to the screen

myI have a bootstrap 3 carousel on my page and I've got it set so that on load the autoplay is disabled

$('#myCarousel').carousel({
  interval: false
});

I've added some more code so that when the text appears on the screen it should start autoplaying

function myCarouselPlay(){
  $('#myCarousel').carousel({
      interval: 5000
  });
}

Unfortunately this isn't working. Any ideas why?

Upvotes: 0

Views: 312

Answers (1)

GunvantParmar
GunvantParmar

Reputation: 143

Hello Can you please try this

<script type="text/javascript">
$(document).ready(function () {
    $('.carousel').carousel({
        interval: 3000
    });

    $('.carousel').carousel('cycle');
});
</script> 

Upvotes: 0

Related Questions