diff --git a/README.md b/README.md index 1fdb882..e2df089 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Требования -- [Swiper](https://github.com/nolimits4web/swiper) версии 4.5.x +- [Swiper](https://github.com/nolimits4web/swiper) версии ^10.2.0 ## Подключение и настройка diff --git a/index.js b/index.js index f7aafa9..63f1c1a 100644 --- a/index.js +++ b/index.js @@ -97,8 +97,10 @@ const show = async (duration = 500, easing = 'linear') => { }; const init = async (items = [], options = {}, index = 0) => { - const {Swiper, Navigation, Pagination} = await import('swiper'); - Swiper.use([Navigation, Pagination]); + const [{default: Swiper}, {Navigation, Pagination}] = await Promise.all([ + import('swiper'), + import('swiper/modules'), + ]); let isVideoInGallery = false; items = items.map((item) => { @@ -153,7 +155,7 @@ const init = async (items = [], options = {}, index = 0) => { -
+
${items.join('')}
@@ -170,7 +172,7 @@ const init = async (items = [], options = {}, index = 0) => { const swiper = new Swiper( gallery.querySelector('.advdominion-lg__container'), - Object.assign({init: false, initialSlide: index}, options.swiper) + Object.assign({modules: [Navigation, Pagination], init: false, initialSlide: index}, options.swiper) ); swiper.on('init', function () { diff --git a/package.json b/package.json index c3cff73..0928ee5 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,6 @@ "@advdominion/get-scrollbar-width": "^1.0.0" }, "peerDependencies": { - "swiper": "4.5.1" + "swiper": "^10.2.0" } }