From bffa0b69b10b008c07a9593dabda1ae29459d417 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 28 Oct 2021 11:00:52 +0100 Subject: [PATCH] set video position on resize --- app/static/js/ascroll.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/static/js/ascroll.js b/app/static/js/ascroll.js index 2a584b4..d62bc97 100755 --- a/app/static/js/ascroll.js +++ b/app/static/js/ascroll.js @@ -41,6 +41,14 @@ function setVideoSrc(video, src) { } } +function resize() { + var video = document.querySelector('video') + if (video && video._frame) { + var rect = video._frame.getBoundingClientRect(); + video.style.top = (rect.top + window.scrollY) + 'px' + } +} + function updatePlayer(video, frame, currentTime, out, src) { var rect = frame.getBoundingClientRect(); video.style.opacity = 0 @@ -362,3 +370,6 @@ if (config.annotations) { } else { loadAnnotations(config) } + + +window.addEventListener('resize', resize, false);