Javascript 使用Glide.js获取当前幻灯片索引

Javascript 使用Glide.js获取当前幻灯片索引,javascript,jquery,carousel,swiper,glidejs,Javascript,Jquery,Carousel,Swiper,Glidejs,使用GLide.js在元素之间滑动时,如何获取当前幻灯片索引/编号 const config = { type: "carousel", perView: 5, startAt: 2, perTouch: 1, focusAt: "center", }; new Glide(".glide", config) .on("swipe.end", function (event) { console.log(event);

使用GLide.js在元素之间滑动时,如何获取当前幻灯片索引/编号

 const config = {
    type: "carousel",
    perView: 5,
    startAt: 2,
    perTouch: 1,
    focusAt: "center",
  };
  new Glide(".glide", config)
    .on("swipe.end", function (event) {
      console.log(event);
    })
    .mount();
试用

试用

const config = {
  type: "carousel",
  perView: 5,
  startAt: 2,
  perTouch: 1,
  focusAt: "center",
};

var glide = new Glide(".glide", config)

glide.on("swipe.end", function(event) {
  console.log('on swipe.end', glide.index)
})

glide.mount()

console.log(glide.index)