I'm trying to have a custom button with a click functionality to move to the next slide. I am doing it exactly like in this official example: https://codepen.io/desandro/pen/emVpdz
But I get always this error from the console:
Uncaught TypeError: $(...).flickity is not a function
Here my code:
<script>
var $carousel = $('.main-carousel').flickity();
// previous
$('.button--previous').on( 'click', function() {
$carousel.flickity('previous');
});
</script>
The flickity slider works perfectly but not this button/link outside.
Thanky you for any hints. Best, L