I want to be able to create a button anywhere on the page, that when clicked, makes the slider go to slide(N).
As far as I can tell, Bricks uses Swiper.js - is this right?
In which case I should have swiper.slideTo(n) available?
But I cannot get it to work. Can anyone tell me how the slider is called - and so what name I need to call it?
I’ve tried:
Swiper.slideTo(1);
Which leads to “Swiper.slideTo is not a function”
Swiper[0].slideTo(1);
Which gives: “Cannot read properties of undefined (reading ‘slideTo’)”
bricksSwiper[0].slideNext(1000);
bricksSwiper.swiper.slideNext(1000);
And about 1,000 variations. I’m stupid, and have no idea how to find the right call. Anyone on the dev team able to tell me how this
const swiper = new Swiper('.swiper', {
Is formatted in Bricks, and so what ‘swiper’ I can call - or how to format this tiny snippet?
<script>
let btn = document.getElementById("btn10");
btn.addEventListener('click', event => {
swiper.slideTo(2);
});
</script>
Sorry the terminology is probably garbage - I am not a JS man.