https://glidejs.com/docs/components/autoplay/

https://stackoverflow.com/questions/52768768/autoplay-start-stop-with-glidejs-carousel

https://nickpiscitelli.github.io/Glider.js/

https://stackoverflow.com/questions/62122998/implementing-autoplay-on-glider-js

https://github.com/NickPiscitelli/Glider.js/issues/43

let slider = new Glider(document.querySelector('.glider'), {
    slidesToScroll: 1,
    slidesToShow: 1,
    draggable: false,
    scrollLock: true,
    rewind: true,
    dots: '#dots',
});

let autoplayDelay = 3500;

let autoplay = setInterval(() => {
    slider.scrollItem('next')
}, autoplayDelay);

element.addEventListener('mouseover', (event) => {
    if (autoplay != null) {
        clearInterval(autoplay);
        autoplay = null;
    }
}, 300);

element.addEventListener('mouseout', (event) => {
    if (autoplay == null) {
        autoplay = setInterval(() => {
            slider.scrollItem('next')
        }, autoplayDelay);
    }
}, 300);
 
댓글은 로그인 사용자만 작성 가능합니다. 로그인하기