From febc9c58f350c056a88b547f0bf07f5a206b50d1 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 11 Oct 2023 18:18:17 +0200 Subject: [PATCH] wip #6400 @0.75 --- js/quiz.match.js | 52 ++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/js/quiz.match.js b/js/quiz.match.js index cbc1689..59471e6 100644 --- a/js/quiz.match.js +++ b/js/quiz.match.js @@ -82,25 +82,25 @@ QuizMatch.prototype = { this.animateContent() }, - animateContent: function() { + animateContent: function () { let slidesNext = this.swiperBottomEl.find(".swiper-slide-active").nextAll() let slidesPrev = this.swiperBottomEl.find(".swiper-slide-active").prevAll() let slideActive = this.swiperBottomEl.find(".swiper-slide-active") const rules = { - opacity: function(index) { + opacity: function (index) { let opacity = 0 - if(index === 0) { + if (index === 0) { opacity = 0.8 - }else if(index === 1) { + } else if (index === 1) { opacity = 0.6 - }else if(index === 2) { + } else if (index === 2) { opacity = 0.4 } return opacity }, ease: "power1.inOut", stagger: .15, - onComplete: function() { + onComplete: function () { $(this.target).removeClass("not-visible") } } @@ -109,18 +109,18 @@ QuizMatch.prototype = { this.timeline.to(".active-screen .top-slider-container", { opacity: 1 }) - .to(".active-screen .bottom-slider", { - opacity: 1 - }) - .to(slideActive, { - opacity: 1 - }) - .to(slidesNext, { - ...rules - }, ">-0.5") - .to(slidesPrev, { - ...rules - }, "<") + .to(".active-screen .bottom-slider", { + opacity: 1 + }) + .to(slideActive, { + opacity: 1 + }) + .to(slidesNext, { + ...rules + }, ">-0.5") + .to(slidesPrev, { + ...rules + }, "<") }, @@ -151,7 +151,7 @@ QuizMatch.prototype = { $(slide).css({transform: 'rotate(' + angle + 'deg) translateY(' + top + 'px)'}); if (this.timeline) { if (this.timeline.progress() > 0) { - $(slide).css('opacity',opacity) + $(slide).css('opacity', opacity) } } }, @@ -164,16 +164,20 @@ QuizMatch.prototype = { this.swiperBottom.update() if (this.swiperTop.activeIndex === lastIndex) { - this.switchMatchValidateButton() + this.validateAnswers() return false; } - this.swiperTop.slideNext() + this.swiperTop.slideNext(); }, - switchMatchValidateButton: function () { - let btn = $(".active-screen").find(".confirmMatch"), text = this.quiz.l10n.__('Validate answer'); - btn.removeClass("confirmMatch").addClass("action validate").find('.text').text(text) + validateAnswers: function () { + let btn = $(".active-screen").find(".confirmMatch"); + btn.removeClass("confirmMatch").addClass("action validate"); + setTimeout(function () { + $(".active-screen").find(".validate").get(0).click(); + }, 100); + }, reset: function () { -- 2.39.5