Login With Github

Swiper API: Autoplay

Autoplay Parameters

Parameter Type Default Description
autoplay object/boolean  

Object with autoplay parameters or boolean true to enable with default settings. For example:

var mySwiper = new Swiper('.swiper-container', {
  autoplay: {
    delay: 5000,
  },
});

 

{
delay number 3000

Delay between transitions (in ms). If this parameter is not specified, auto play will be disabled

If you need to specify different delay for specific slides you can do it by using data-swiper-autoplay (in ms) attribute on slide:

<!-- hold this slide for 2 seconds -->
<div class="swiper-slide" data-swiper-autoplay="2000">
stopOnLastSlide boolean false Enable this parameter and autoplay will be stopped when it reaches last slide (has no effect in loop mode)
disableOnInteraction boolean true Set to false and autoplay will not be disabled after user interactions (swipes), it will be restarted every time after interaction
reverseDirection boolean false Enables autoplay in reverse direction
waitForTransition boolean true When enabled autoplay will wait for wrapper transition to continue. Can be disabled in case of using Virtual Translate when your slider may not have transition
}

Autoplay Methods & Properties

Properties
mySwiper.autoplay.running Whether autoplay enabled and running
Methods
mySwiper.autoplay.start(); Start autoplay
mySwiper.autoplay.stop(); Stop autoplay

Autoplay Events

Event name Arguments Description
autoplayStart   Event will be fired in when autoplay started
autoplayStop   Event will be fired when autoplay stopped
autoplay   Event will be fired when slide changed with autoplay

0 Comment

temp