Make sure content is resized after images in content types are laoded. [HFJ-1091]

pull/2/head
Thomas Marstrander 2015-09-24 13:16:54 +02:00
parent 848a680de4
commit e0f8afb3f9
1 changed files with 9 additions and 0 deletions

View File

@ -360,12 +360,21 @@ H5P.QuestionSet = function (options, contentId) {
} }
} }
var registerImageLoadedListener = function (question) {
H5P.on(question, 'imageLoaded', function () {
self.trigger('resize');
});
};
// Attach questions // Attach questions
for (var i = 0; i < questionInstances.length; i++) { for (var i = 0; i < questionInstances.length; i++) {
var question = questionInstances[i]; var question = questionInstances[i];
question.attach($('.question-container:eq(' + i + ')', $myDom)); question.attach($('.question-container:eq(' + i + ')', $myDom));
// Listen for image resize
registerImageLoadedListener(question);
// Disable feedback for question // Disable feedback for question
question.setBehaviour({disableFeedback: true}); question.setBehaviour({disableFeedback: true});