hexo-theme-stellar/layout/_plugins/swiper.ejs

27 lines
802 B
Plaintext
Raw Permalink Normal View History

2024-02-12 23:07:56 +08:00
<script>
window.addEventListener('DOMContentLoaded', (event) => {
const swiper_api = document.getElementById('swiper-api');
if (swiper_api != undefined) {
utils.css(`<%- conf.css %>`);
utils.js(`<%- conf.js %>`, { defer: true }).then(function () {
const effect = swiper_api.getAttribute('effect') || '';
var swiper = new Swiper('.swiper#swiper-api', {
slidesPerView: 'auto',
spaceBetween: 8,
centeredSlides: true,
effect: effect,
2024-04-06 19:38:34 +08:00
rewind: true,
2024-02-12 23:07:56 +08:00
pagination: {
el: '.swiper-pagination',
clickable: true,
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});
})
}
});
2024-04-06 19:38:34 +08:00
</script>