Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed hiding of slides by using visibility instead of display. #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions css/questionset.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.questionset .question-container:not(.h5p-questionset-visible){
position: absolute;
left: -100%;
visibility: hidden;
}

.questionset-results h2 {
font-size: 1.2em;
font-weight: bold;
Expand Down
22 changes: 11 additions & 11 deletions js/questionset.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ H5P.QuestionSet = function (options, contentId, contentData) {
handleAutoPlay(currentQuestion);

// Hide all questions
$('.question-container', $myDom).hide().eq(questionNumber).show();
$('.question-container', $myDom).removeClass('h5p-questionset-visible').eq(questionNumber).addClass('h5p-questionset-visible');

if (questionInstances[questionNumber]) {
// Trigger resize on question in case the size of the QS has changed.
Expand Down Expand Up @@ -704,12 +704,12 @@ H5P.QuestionSet = function (options, contentId, contentData) {
var _displayEndGame = function () {
$('.progress-dot.current', $myDom).removeClass('current');
if (rendered) {
$myDom.children().hide().filter('.questionset-results').show();
$myDom.children().removeClass('h5p-questionset-visible').filter('.questionset-results').addClass('h5p-questionset-visible');
self.trigger('resize');
return;
}
//Remove old score screen.
$myDom.children().hide().filter('.questionset-results').remove();
$myDom.children().removeClass('h5p-questionset-visible').filter('.questionset-results').remove();
rendered = true;

// Get total score.
Expand Down Expand Up @@ -748,28 +748,28 @@ H5P.QuestionSet = function (options, contentId, contentData) {
};

// Show result page.
$myDom.children().hide();
$myDom.children().removeClass('h5p-questionset-visible');
$myDom.append(endTemplate.render(eparams));

if (params.endGame.showResultPage) {
hookUpButton('.qs-solutionbutton', function () {
showSolutions();
$myDom.children().hide().filter('.questionset').show();
$myDom.children().removeClass('h5p-questionset-visible').filter('.questionset').addClass('h5p-questionset-visible');
_showQuestion(params.initialQuestion);
});
hookUpButton('.qs-retrybutton', function () {
resetTask();
$myDom.children().hide();
$myDom.children().removeClass('h5p-questionset-visible');

var $intro = $('.intro-page', $myDom);
if ($intro.length) {
// Show intro
$('.intro-page', $myDom).show();
$('.intro-page', $myDom).addClass('h5p-questionset-visible');
$('.qs-startbutton', $myDom).focus();
}
else {
// Show first question
$('.questionset', $myDom).show();
$('.questionset', $myDom).addClass('h5p-questionset-visible');
_showQuestion(params.initialQuestion);
}
});
Expand Down Expand Up @@ -803,7 +803,7 @@ H5P.QuestionSet = function (options, contentId, contentData) {
if (params.endGame.showAnimations) {
var videoData = success ? params.endGame.successVideo : params.endGame.failVideo;
if (videoData) {
$myDom.children().hide();
$myDom.children().removeClass('h5p-questionset-visible');
var $videoContainer = $('<div class="video-container"></div>').appendTo($myDom);

var video = new H5P.Video({
Expand Down Expand Up @@ -954,7 +954,7 @@ H5P.QuestionSet = function (options, contentId, contentData) {
$('.qs-startbutton', $myDom)
.click(function () {
$(this).parents('.intro-page').hide();
$('.questionset', $myDom).show();
$('.questionset', $myDom).addClass('h5p-questionset-visible');
_showQuestion(params.initialQuestion);
event.preventDefault();
})
Expand All @@ -963,7 +963,7 @@ H5P.QuestionSet = function (options, contentId, contentData) {
case 13: // Enter
case 32: // Space
$(this).parents('.intro-page').hide();
$('.questionset', $myDom).show();
$('.questionset', $myDom).addClass('h5p-questionset-visible');
_showQuestion(params.initialQuestion);
event.preventDefault();
}
Expand Down