Fix flickering for embedded content on iPads

see https://github.com/h5p/h5p-moodle-plugin/issues/237
pull/58/head moodle-1.16
Thomas Marstrander 2019-03-07 15:48:21 +01:00
parent 7b7b35ea39
commit 1a09b1a30e
1 changed files with 5 additions and 0 deletions

View File

@ -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';