'Multiple instances of glider.js

I am using glider.js https://nickpiscitelli.github.io/Glider.js/ and try to add multiple gliders to a website:

$('.glider').each(function(elm) {
new Glider(document.querySelector('#'+elm.id), {
    slidesToShow: 2,
    dots: '#glider-dots-'+elm.id,
    arrows: {
        prev: '#glider-prev-'+elm.id,
        next: '#glider-next-'+elm.id
    }
});

});

The glider loads but the problem is that the dots, prev and next button does not work.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source