I'm new to jQuery and I want to import Swiper but it doesn't work, what's the problem? I copy and paste from main source but I don't know the problem.
i get the following error: "Uncaught SyntaxError: import declarations may only appear at top level of a module"
import Swiper from 'swiper';
import 'swiper/swiper-bundle.css';
import Swiper, { Navigation, Pagination } from 'swiper';
Swiper.use([Navigation, Pagination]);
import Swiper from 'swiper/bundle';
$(function () {
const timelineSwiper = new Swiper ('.timeline .swiper-container', {
direction: 'vertical',
loop: false,
speed: 1599,
pagination: '.swiper-pagination',
paginationBulletRender: function (swiper, index, className){
var year = document.querySelectorAll('.swiper-slide')
[index].getAttribute('date-year');
return '<span class="' +className + '">' + year + '</span>';
},
paginationClickable:true,
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
breakpoint: {
778: {
direction: 'horizontal',
}
}
});
});