[슬라이더 플러그인] glider.js autoplay
2020.06.24 11:50
1
https://eond.com/434874

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);

라이믹스는 이온디와 함께

닫기

마이페이지

로그인을 해주세요