add_action( 'wp_footer', function () { ?>
<script>

jQuery(document).ready(function( $ ){
  	jQuery('.elementor_posts_carousel .elementor-widget-container').addClass("swiper-container");
	jQuery('.elementor_posts_carousel .elementor-posts-container').addClass("swiper-wrapper");
	jQuery('.elementor_posts_carousel .elementor-post').addClass("swiper-slide");
	//jQuery('.swiper-container').append('<div class="swiper-pagination"></div><div class="swiper-button-prev"></div><div class="swiper-button-next"></div>');
	
const swiper = new Swiper('.swiper-container', {
        slidesPerView: 3,
        slidesPerGroup: 1,
		spaceBetween:0,
        loop: true,
		autoplay:true,
		breakpoints: {
			640: {
				slidesPerView: 1,
				spaceBetween: 20,
			},
			768: {
				slidesPerView: 1,
				spaceBetween: 40,
			},
			1024: {
				slidesPerView: 3,
				spaceBetween: 50,
			},
		},
        pagination: {
          el: ".swiper-pagination",
          clickable: true,
        },
        navigation: {
          nextEl: ".swiper-button-next",
          prevEl: ".swiper-button-prev",
        },
      });
});
	
</script>

<style>
	.swiper-wrapper {
    display: flex!important;
    flex-wrap: inherit!important;
	}
	.swiper-container {
		--grid-column-gap: none;
	}
</style>

<?php } );
