Обновление 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 {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) => {
|
|||
<button class="advdominion-lg__close" type="button">
|
||||
<svg class="advdominion-lg__close-icon"><use href="${options.icons.close}" /></svg>
|
||||
</button>
|
||||
<div class="advdominion-lg__container swiper-container">
|
||||
<div class="advdominion-lg__container swiper">
|
||||
<div class="advdominion-lg__wrapper swiper-wrapper">
|
||||
${items.join('')}
|
||||
</div>
|
||||
|
@ -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 () {
|
||||
|
|
|
@ -13,6 +13,6 @@
|
|||
"@advdominion/get-scrollbar-width": "^1.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"swiper": "4.5.1"
|
||||
"swiper": "^10.2.0"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue