diff --git a/plugins/lazyYT/assets/javascripts/initializers/lazyYT.js.es6 b/plugins/lazyYT/assets/javascripts/initializers/lazyYT.js.es6 index b05cf205393..21037618f79 100644 --- a/plugins/lazyYT/assets/javascripts/initializers/lazyYT.js.es6 +++ b/plugins/lazyYT/assets/javascripts/initializers/lazyYT.js.es6 @@ -11,14 +11,6 @@ export default { const iframes = $('.lazyYT', $elem); if (iframes.length === 0) { return; } - // We use this because watching videos fullscreen in Chrome was super buggy - // otherwise. Thanks to arrendek from q23 for the technique. - $elem.iframeTracker({ blurCallback: () => { - $(document).on("scroll.discourse-youtube", returnFalse); - window.setTimeout(() => $(document).off('scroll.discourse-youtube', returnFalse), 1500); - $(document).scroll(); - }}); - $('.lazyYT', $elem).lazyYT({ onPlay(e, $el) { // don't cloak posts that have playing videos in them @@ -26,6 +18,14 @@ export default { if (postId) { api.preventCloak(postId); } + + // We use this because watching videos fullscreen in Chrome was super buggy + // otherwise. Thanks to arrendek from q23 for the technique. + $('iframe', iframes).iframeTracker({ blurCallback: () => { + $(document).on("scroll.discourse-youtube", returnFalse); + window.setTimeout(() => $(document).off('scroll.discourse-youtube', returnFalse), 1500); + $(document).scroll(); + }}); } });