diff --git a/app/static/js/ascroll.js b/app/static/js/ascroll.js index c018c95..2a06e06 100644 --- a/app/static/js/ascroll.js +++ b/app/static/js/ascroll.js @@ -61,6 +61,11 @@ function onVisibilityChange(el, callback) { var visible = isElementInViewport(el); if (visible != old_visible) { old_visible = visible; + if (visible) { + el.classList.add('visible') + } else { + el.classList.remove('visible') + } if (typeof callback == 'function') { callback(visible); } @@ -208,8 +213,9 @@ function loadItem(config) { ascroll.appendChild(div) var frame = div.querySelector('.frame') document.addEventListener('scroll', onVisibilityChange(div.querySelector('.frame'), function(visible) { - if (loaded && visible) + if (loaded && visible) { updatePlayer(video, frame, annotation['in'], annotation['out']) + } })) }) @@ -222,7 +228,6 @@ function loadItem(config) { } function loadEdit(config) { pandoraAPI('getEdit', {id: config.edit, keys: []}).then(response => { - console.log(response) var ascroll = document.querySelector('#ascroll') var loaded = false @@ -260,8 +265,9 @@ function loadEdit(config) { var frame = div.querySelector('.frame') document.addEventListener('scroll', onVisibilityChange(div.querySelector('.frame'), function(visible) { var src = `${baseURL}/${annotation.id.split('/')[0]}/480p.webm` - if (loaded && visible) + if (loaded && visible) { updatePlayer(video, frame, annotation['in'], annotation['out'], src) + } })) })