Support » Plugin: Carousel Slider Block » Enable Autoplay

  • Resolved fmarconi

    (@fmarconi)


    For anyone who ask, I’ve enabled autoplay just by adding this code to my child theme functions.php It can be done with wp_enqueue_script and a external file also. I’ve tried to filter the plugin init enqueuing processes in init.php to target the slider before created but i couldn’t. If anyone has a better approach it would be great.

    add_action('wp_footer', 'slider_autoplay');
    function slider_autoplay()
    {
    	?>
    	<script>
    		jQuery(document).ready(function($){
    			$('.wp-block-cb-carousel').slick('slickSetOption',{
    			autoplay:true,
    			autoplaySpeed:2000,
    			infinite: true,
    			}, true);
    		});
    	  </script>
    	<?php
    }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.