From 1a09b1a30e61fc9f6454f1e79a0f8f35290413fd Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Thu, 7 Mar 2019 15:48:21 +0100 Subject: [PATCH] Fix flickering for embedded content on iPads see https://github.com/h5p/h5p-moodle-plugin/issues/237 --- js/h5p.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/h5p.js b/js/h5p.js index e5a4262..92283f3 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -263,6 +263,11 @@ H5P.init = function (target) { var parentHeight = iframe.parentElement.style.height; iframe.parentElement.style.height = iframe.parentElement.clientHeight + 'px'; + // Note: Force layout reflow + // This fixes a flickering bug for embedded content on iPads + // @see https://github.com/h5p/h5p-moodle-plugin/issues/237 + iframe.getBoundingClientRect(); + // Reset iframe height, in case content has shrinked. iframe.style.height = '1px';