I am trying to create a post slider that shows one post at a time using Swiper JS. I am using Elementor Pro with Custom Post Type UI, Advanced Custom Fields and Ele Custom Skin plugins.
With Ele Custom Skin I have a custom loop template created for the slider and I have used the following code to try and make this design into a slider but with no such luck.
Help appreciated.
(For reference, I'm trying to achieve something similar to the timeline slider on this page: https://rudehealth.com/about-us/)
JAVASCRIPT
jQuery(".post_slide .elementor-widget-container").addClass("swiper-container");
jQuery(".post_slide .elementor-posts-container").addClass("swiper-wrapper");
jQuery(".post_slide .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>');
var swiper = new Swiper('.swiper-container', {
spaceBetween: 0,
slidesPerView: 1,
autoplay:true,
breakpoints: {
640: {
slidesPerView: 1,
spaceBetween: 0,
},
768: {
slidesPerView: 1,
spaceBetween: 0,
},
1024: {
slidesPerView: 1,
spaceBetween: 0,
},
},
pagination: {
el: '.swiper-pagination',
clickable: true,
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});
});
CSS
display: flex !important;
flex-wrap: inherit;
}```