Resize QS container when Q changes size.
parent
7bb0a928f1
commit
80c6b0678d
|
@ -110,6 +110,7 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
var questionInstances = [];
|
var questionInstances = [];
|
||||||
var $myDom;
|
var $myDom;
|
||||||
var scoreBar;
|
var scoreBar;
|
||||||
|
var up;
|
||||||
renderSolutions = false;
|
renderSolutions = false;
|
||||||
|
|
||||||
// Instantiate question instances
|
// Instantiate question instances
|
||||||
|
@ -126,11 +127,21 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, {parent: self});
|
var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, {parent: self});
|
||||||
|
questionInstance.on('resize', function () {
|
||||||
|
up = true;
|
||||||
|
self.trigger('resize');
|
||||||
|
});
|
||||||
questionInstances.push(questionInstance);
|
questionInstances.push(questionInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize all interactions on resize
|
// Resize all interactions on resize
|
||||||
self.on('resize', function () {
|
self.on('resize', function () {
|
||||||
|
if (up) {
|
||||||
|
// Prevent resizing the question again.
|
||||||
|
up = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < questionInstances.length; i++) {
|
for (var i = 0; i < questionInstances.length; i++) {
|
||||||
questionInstances[i].trigger('resize');
|
questionInstances[i].trigger('resize');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue