Add the JavaScript code snippet provided below to your website’s footer. This code utilizes the Splide.js library to enable auto-scrolling functionality for your sliders.
<script src="https://cdn.jsdelivr.net/npm/@splidejs/splide-extension-auto-scroll@0.5.3/dist/js/splide-extension-auto-scroll.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', (event) => {
// Define a function to update the no-drag option for all splide instances on the page
const updateNoDragOption = () => {
for( const splideId in window.bricksData.splideInstances ) {
const splideInstance = window.bricksData.splideInstances['ccklkt']
if ( splideInstance ) {
splideInstance.destroy();
splideInstance.mount( window.splide.Extensions );
splideInstance.options = {
autoScroll:
{
speed: .5,
},
}
}
}
}
// Need some delay for Bricks to init the sliders
setTimeout(updateNoDragOption, 250)
})
</script>
‘ccklkt’ is nestable slider element id.
