Более корректное воспроизведение видео при быстром пролистывании (fix)
This commit is contained in:
parent
c710fdd56a
commit
f953780e84
16
index.js
16
index.js
|
@ -348,15 +348,17 @@ const init = async (items = [], options = {}, index = 0) => {
|
|||
});
|
||||
|
||||
swiper.on('slideChange', function () {
|
||||
for (const [index, slide] of Object.entries(this.slides)) {
|
||||
if (slide.classList.contains('advdominion-lg__item_video')) {
|
||||
if (Number(index) === this.activeIndex) {
|
||||
playVideo(slide);
|
||||
} else {
|
||||
pauseVideo(slide);
|
||||
setTimeout(() => {
|
||||
for (const [index, slide] of Object.entries(this.slides)) {
|
||||
if (slide.classList.contains('advdominion-lg__item_video')) {
|
||||
if (Number(index) === this.activeIndex) {
|
||||
playVideo(slide);
|
||||
} else {
|
||||
pauseVideo(slide);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
swiper.on('resize', function () {
|
||||
|
|
Loading…
Reference in New Issue