clearTimeout(this.instantReviewAnimationTimeout);
},
+ fadeOut: function (el, remove) {
+ $(el).addClass('animateOpacity disabled').css('opacity', 0);
+ if (remove === true) {
+ setTimeout(function () {
+ $(el).remove();
+ }, 500);
+ }
+ },
+
triggeredBtn: function () {
/*$(document).on("mousedown", ".btn", function() {
gsap.to($(this), { scale: .9, duration: 0.3 });
import 'simplebar/dist/simplebar.css'
import Handlebars from "handlebars";
-function QuizScreenOutro(quiz) {
- this.quiz = quiz;
+function QuizScreenOutro(screens) {
+ this.quiz = screens.quiz;
+ this.screens = screens;
+
+ this.initEvents();
}
QuizScreenOutro.prototype = {
- show: function () {
+ initEvents: function () {
+ $(document).on("click", ".toggle-answers-review", function () {
+ $(".score-answers-review_container").toggleClass("active")
+ })
+ },
+ show: function () {
let maxScore = this.quiz.score.maxScore,
score = this.quiz.score.score
// https://github.com/Grsmto/simplebar/tree/master/packages/simplebar
const simpleBar = new SimpleBar($ul.get(0))
}
-
};
-export default QuizScreenOutro;
\ No newline at end of file
+export default QuizScreenOutro;
alert('Please select at least one answer');
return false;
}
+
+ //
+
if ($(this).hasClass('validate')) {
let review = $this.sendUserAnswers();
// Si la revue instantanée est activée, on affiche les résultats
$(form).addClass('disabled');
// Remove validate button and show continue button
- $(activeScreen).find('.btn.validate').addClass('none');
- $(activeScreen).find('.btn.continue').removeClass('none');
+ setTimeout(function () {
+ $(activeScreen).find('.btn.continue').removeClass('none')
+ $(activeScreen).find('.btn.validate').addClass('none');
+ }, 10);
+
+
+ // Hide reset button
+ this.quiz.animations.fadeOut($(activeScreen).find('.btn.reset'), true);
let results = review.answersStatus;
if (answerResult !== "neutral") {
$el.find(".access").addClass(answerResult).html(icon);
} else {
- $el.find(".access").remove();
+ this.quiz.animations.fadeOut($el.find(".access"));
}
}
},
let nextQuestionIndex = this.quiz.question.currentPosition() + 1;
let nextScreen;
if (nextQuestionIndex >= this.quiz.question.count()) {
- nextScreen = 'review';
+ nextScreen = 'outro';
} else {
nextScreen = 'q-' + nextQuestionIndex;
}
callback();
}
$this.activeScreen = screenToShow;
+ // Reset form to prevent browser letting a option selected after a refresh
+ $this.resetForm();
$this.currentQuestionAnswers = [];
$this.quiz.progressbar.update();
+ if (screen === 'outro') {
+ $this.outro.show();
+ }
});
},
return this.getActiveScreen().find('form');
},
- resetForm: () => {
+ resetForm: function () {
this.getCurrentForm().find("input").prop("checked", false)
},
QuizUtils.prototype = {
isVisible(e) {
- if ($(e).length == 0) {
+ if ($(e).length === 0) {
+ return false;
+ }
+ if ($(e).css('display') === 'none' || $(e).css('visibility') === 'hidden' || $(e).css('opacity') == 0) {
return false;
}
let elt = $(e).get(0);
+
return elt.offsetWidth || elt.offsetHeight || elt.getClientRects().length;
},
isEnabled: function (e) {
if ($(e).hasClass('disabled') || $(e).closest('.disabled').length > 0) {
return false;
}
+ console.log('is enabled', e);
return true;
},
--- /dev/null
+.animateOpacity
+ transition: opacity 350ms
@import 002-item-variables
@import 003-reset
@import 004-mixins
+@import 006-animations
@import 100-global
@import 101-header-footer
-<div class="container-screen none" data-screen="review">
+<div class="container-screen none" data-screen="outro">
@include('header_title', ['data', $data])
<div class="screen score" id="score">
<div class="score-content">