Более корректное воспроизведение видео при быстром пролистывании (fix)

This commit is contained in:
Valentin Silytuin 2025-04-24 23:59:38 +04:00
parent c710fdd56a
commit f953780e84
1 changed files with 9 additions and 7 deletions

View File

@ -348,15 +348,17 @@ const init = async (items = [], options = {}, index = 0) => {
}); });
swiper.on('slideChange', function () { swiper.on('slideChange', function () {
for (const [index, slide] of Object.entries(this.slides)) { setTimeout(() => {
if (slide.classList.contains('advdominion-lg__item_video')) { for (const [index, slide] of Object.entries(this.slides)) {
if (Number(index) === this.activeIndex) { if (slide.classList.contains('advdominion-lg__item_video')) {
playVideo(slide); if (Number(index) === this.activeIndex) {
} else { playVideo(slide);
pauseVideo(slide); } else {
pauseVideo(slide);
}
} }
} }
} });
}); });
swiper.on('resize', function () { swiper.on('resize', function () {