From 24498a46ffd2d4146ae63eb54b35d8e658e1a080 Mon Sep 17 00:00:00 2001 From: soufiane Date: Tue, 19 Mar 2024 17:31:00 +0100 Subject: [PATCH] wait #6809 @1:30 Modification de l'appel de outro --- js/quiz.screen.outro.js | 22 +++++++++++----------- js/quiz.screens.js | 6 ++++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/js/quiz.screen.outro.js b/js/quiz.screen.outro.js index 5283d61..fbba9b0 100644 --- a/js/quiz.screen.outro.js +++ b/js/quiz.screen.outro.js @@ -7,15 +7,13 @@ import {DrawSVGPlugin} from "gsap/DrawSVGPlugin.js"; function QuizScreenOutro(screens) { this.quiz = screens.quiz; this.screens = screens; - - this.initEvents(); } QuizScreenOutro.prototype = { initEvents: function () { const $this = this; - let popup = $("#resume") - let quiz = $("#quiz").get(0) + this.popup = $("#resume") + this.quizEL = $("#quiz").get(0) $(document).on("click", ".toggle-answers-review", function () { $(".score-answers-review_container").toggleClass("active") @@ -25,25 +23,27 @@ QuizScreenOutro.prototype = { }); $(document).on("mousemove", function(e) { - let x = e.clientX - quiz.getBoundingClientRect().left - let y = e.clientY - quiz.getBoundingClientRect().top + let x = e.clientX - $this.quizEL.getBoundingClientRect().left + let y = e.clientY - $this.quizEL.getBoundingClientRect().top - popup.css({ + $this.popup.css({ left: x, top: y, }) }); $(document).on("mouseover", ".area-item, .match-item, .multiple-item", function (e) { - let content = $(this).find(".content").html() + let content = $(this).find(".content").text() if(content) { - popup.html(content) - gsap.to(popup, {autoAlpha: 1}) + $this.popup.html(content) + gsap.to($this.popup, {autoAlpha: 1}) } }).on("mouseout", function () { - gsap.to(popup, {autoAlpha: 0}) + gsap.to($this.popup, {autoAlpha: 0}) }) + + this.show(); }, animate: function (score, percent) { diff --git a/js/quiz.screens.js b/js/quiz.screens.js index 9fb995e..390f4cd 100644 --- a/js/quiz.screens.js +++ b/js/quiz.screens.js @@ -187,7 +187,7 @@ QuizScreens.prototype = { $this.quiz.progressbar.update(); if (screen === 'outro') { - $this.outro.show(); + $this.outro.initEvents(); } $this.quiz.resize.resize(); @@ -338,7 +338,9 @@ QuizScreens.prototype = { validateEmail: function (email) { let re = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i; return re.test(email); - }, reset: function () { + }, + + reset: function () { $("#screens").html(this.screensHTML); } }; -- 2.39.5