微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

幻灯片自动播放空白,然后以 Shopify 叙事主题结束

如何解决幻灯片自动播放空白,然后以 Shopify 叙事主题结束

我希望在叙事主题自动播放幻灯片效果很好,尽管在自动播放幻灯片结束时,它会在重新启动之前挂在空白幻灯片上很长一段时间。我怎样才能删除它并使它向右滑动到第一张图像而不是显示空白。任何帮助都会很棒。我将此代码输入 custom.js

var sections = window.theme.sections;
var slideshowAutoExtension = {
  init: function() {
    this.on('slideshow_desktop_init_done',this._autoplaySlideshow.bind(this));
  },_autoplaySlideshow: setInterval(function() {
    var $slide = $('.slideshow__slide--active')
                   .removeClass('slideshow__slide--active');

    var $button = $('.slideshow__button--active')
                   .removeClass('slideshow__button--active');

    var $slides = $('.slideshow__slide');

    var currentIndex = ($slides.index($slide) + 1) % $slides.length;

    $slides
      .eq(currentIndex)
      .addClass('slideshow__slide--active');

    var $buttons = $('.slideshow__button')
      .eq(currentIndex)
      .addClass('slideshow__button--active');

  },5000)

};

'''

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。