如何更改 swiper.js 中滑动器的延迟?

How to change Delay in swiper in swiper.js?

我正在使用 swiper.js 制作图片和视频的幻灯片。在这里,我想更改用户单击按钮时的延迟。但是我不知道如何更改滑动器的延迟或任何其他方法来做到这一点??

我已阅读 swiper.js 的文档,但在创建滑动器对象后没有更改延迟的功能。

JSFiddle(code)

  <div id="swiper" class="swiper-container mySwiper">
    <div class="swiper-wrapper">
       <div class="swiper-slide">
            <img src="static\images\arlens.gif" alt="ar">
            <span class="subtitle">
                Hi, Reader Thanks for reading
            </span>
        </div>
    </div>
    <div class="swiper-button-next" id="swiper-button-next"></div>
    <div class="swiper-button-prev" id="swiper-button-prev"></div>
</div>
<div class="speed_btns" id="speed_btns">
    <button onclick="change_speed(7500)">1x</button>
    <button onclick="change_speed(5500)">2x</button>
    <button onclick="change_speed(2500)">3x</button>
</div>

JS

let speed = 2500
var swiper2 = new Swiper(".mySwiper", {
        centeredSlides: true,
        autoplay: {
            delay: speed,
            disableOnInteraction: false,
        },
        navigation: {
            nextEl: ".swiper-button-next",
            prevEl: ".swiper-button-prev",
        },

    });
   
  function change_speed(speed){
          // WANT TO CHANGE 'delay' OF 'swiper2' TO 'speed'
  }

希望你能指导我...

一个possible approach, following advice given in this issue:

function change_speed(speed){
  swiper2.params.autoplay.delay = speed;
}

当您将Swiper 的实例存储在变量中时,您可以使用它直接修改它的所有设置。根据 to docs.

,您需要的延迟 - 位于 autoplay 部分