fix bugs an local
This commit is contained in:
1 parent
1380a4dfc8
commit
b2a790337e
24 files changed
+490
-334
No files matched your search
@@ -149,27 +149,6 @@
|
||||
});
|
||||
});
|
||||
|
||||
// Превью: когда карточка попадает в зону видимости, гарантируем загрузку первого кадра
|
||||
const previews = document.querySelectorAll('.work-video-preview');
|
||||
if ('IntersectionObserver' in window && previews.length) {
|
||||
const io = new IntersectionObserver((entries, obs) => {
|
||||
entries.forEach(entry => {
|
||||
if (!entry.isIntersecting) return;
|
||||
const v = entry.target;
|
||||
obs.unobserve(v);
|
||||
if (v.readyState < 2) {
|
||||
v.preload = 'metadata';
|
||||
v.load();
|
||||
}
|
||||
v.addEventListener('loadeddata', () => {
|
||||
if (v.currentTime === 0) { try { v.currentTime = 0.1; } catch (err) {} }
|
||||
v.preload = 'metadata';
|
||||
}, { once: true });
|
||||
});
|
||||
}, { rootMargin: '200px 0px' });
|
||||
previews.forEach(v => io.observe(v));
|
||||
}
|
||||
|
||||
modal.querySelectorAll('[data-video-close]').forEach(el => {
|
||||
el.addEventListener('click', close);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user