Обновление Swiper до 10-й версии
This commit is contained in:
parent
6bcd9a2da3
commit
ba5307fc1e
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## Требования
|
## Требования
|
||||||
|
|
||||||
- [Swiper](https://github.com/nolimits4web/swiper) версии 4.5.x
|
- [Swiper](https://github.com/nolimits4web/swiper) версии ^10.2.0
|
||||||
|
|
||||||
## Подключение и настройка
|
## Подключение и настройка
|
||||||
|
|
||||||
|
|
10
index.js
10
index.js
|
@ -97,8 +97,10 @@ const show = async (duration = 500, easing = 'linear') => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const init = async (items = [], options = {}, index = 0) => {
|
const init = async (items = [], options = {}, index = 0) => {
|
||||||
const {Swiper, Navigation, Pagination} = await import('swiper');
|
const [{default: Swiper}, {Navigation, Pagination}] = await Promise.all([
|
||||||
Swiper.use([Navigation, Pagination]);
|
import('swiper'),
|
||||||
|
import('swiper/modules'),
|
||||||
|
]);
|
||||||
|
|
||||||
let isVideoInGallery = false;
|
let isVideoInGallery = false;
|
||||||
items = items.map((item) => {
|
items = items.map((item) => {
|
||||||
|
@ -153,7 +155,7 @@ const init = async (items = [], options = {}, index = 0) => {
|
||||||
<button class="advdominion-lg__close" type="button">
|
<button class="advdominion-lg__close" type="button">
|
||||||
<svg class="advdominion-lg__close-icon"><use href="${options.icons.close}" /></svg>
|
<svg class="advdominion-lg__close-icon"><use href="${options.icons.close}" /></svg>
|
||||||
</button>
|
</button>
|
||||||
<div class="advdominion-lg__container swiper-container">
|
<div class="advdominion-lg__container swiper">
|
||||||
<div class="advdominion-lg__wrapper swiper-wrapper">
|
<div class="advdominion-lg__wrapper swiper-wrapper">
|
||||||
${items.join('')}
|
${items.join('')}
|
||||||
</div>
|
</div>
|
||||||
|
@ -170,7 +172,7 @@ const init = async (items = [], options = {}, index = 0) => {
|
||||||
|
|
||||||
const swiper = new Swiper(
|
const swiper = new Swiper(
|
||||||
gallery.querySelector('.advdominion-lg__container'),
|
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 () {
|
swiper.on('init', function () {
|
||||||
|
|
|
@ -13,6 +13,6 @@
|
||||||
"@advdominion/get-scrollbar-width": "^1.0.0"
|
"@advdominion/get-scrollbar-width": "^1.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"swiper": "4.5.1"
|
"swiper": "^10.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue