I'm using this site & Splide.js for the first time. I know some basics but i'm not experienced in this. I want to create multiple slides on my page but the mainslide stays active all the time.
So what I'm doing is creating both sliders:
document.addEventListener( 'DOMContentLoaded', function () {
mainslide = new Splide( '#mainslide', {
type : 'loop',
perPage: 5,
perMove: 1,
direction: 'rtl',
trimSpace: false,
keyboard: true,
gap: '1em',
width: '100%',
height: '100%',
})
wheelslide = new Splide( '#wheelslide', {
type: 'loop',
perPage: 5,
perMove: 1,
direction: 'rtl',
trimSpace: false,
keyboard: true,
gap: '1em',
width: '100%',
height: '100%'
})
} );
When I'm opening my page im doing:
mainslide.mount();
And when i'm opening another page where I want to display another slider i'm doing:
$('#mainslide').hide()
mainslide.destroy(true)
mainslide.mount();
$('#wheelslide').show()
Whats happening now is that the new page or the new slider still thinks i'm working with the first slider. So the first slider does not get destroyed imo. When I console.log the id of the slider i still have the id mainslide01 instead it should be wheelslide01. I'm a bit stuck and I dont know how to continue from here.
Thanks in advance