hexo-theme-stellar/layout/_partial/scripts/swiper.ejs

30 lines
741 B
Plaintext

<script>
function loadSwiper() {
if ($(".md").find(".swiper-container").length == 0) return;
loadCSS('<%- theme.plugins.swiper.css %>');
loadScript('<%- theme.plugins.swiper.js %>', () => {
var swiper = new Swiper('.swiper-container', {
slidesPerView: 'auto',
spaceBetween: 8,
centeredSlides: true,
zoom: true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
autoplay: {
delay: 5000,
disableOnInteraction: false,
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});
});
};
$(function () {
loadSwiper();
});
</script>