I’m starting with npm and despite several tutorials, advice, I can’t get the swipe JS library to work, only js, not with a framework
Link : https://swiperjs.com/get-started
I created a file for my script, I took the basic code to initialize my slider:
script.js
// Swiper
import {Swiper} from '../../node_modules/swiper/swiper-bundle.js';
const swiper = new Swiper('.swiper', {
// Optional parameters
direction: 'vertical',
loop: true,
// If we need pagination
pagination: {
el: '.swiper-pagination',
},
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// And if we need scrollbar
scrollbar: {
el: '.swiper-scrollbar',
},
});
HTML, I added a module type because the console asked me to do so
<script type="module" src="dist/js/script.js"></script>
</body>
</html>
css /scss -> here ok
@use '../../node_modules/swiper/swiper-bundle.css';