start: function() {
const $this = this
let posInit = 0
+ this.positionsX = [{top: "10"},{top: "39"}]
+ this.counter = 0
$(document).on("click", ".move-slide", function () {
let move = $(this).attr("aria-keyshortcuts")
if(move === "ARROWLEFT") {
- swiperBottom.slidePrev()
+ $this.swiperBottom.slidePrev()
}else {
- swiperBottom.slideNext()
+ $this.swiperBottom.slideNext()
}
})
- const swiperTop = new Swiper('.swiper-container.top-slider', {
+ $(document).on("click", ".confirmMatch", function() {
+ $this.confirmTheMatch()
+ })
+
+ this.swiperTop = new Swiper('.swiper-container.top-slider', {
modules: [Navigation, Pagination],
slidesPerView: 1,
loop: true,
},
})
- const swiperBottom = new Swiper('.swiper-container.bottom-slider', {
+ this.swiperBottom = new Swiper('.swiper-container.bottom-slider', {
modules: [Navigation, Pagination],
slidesPerView: "auto",
//loop: true,
+ watchSlidesProgress: true,
centeredSlides: true,
freeMode: true,
spaceBetween: 20,
type: 'bullets',
},
on: {
- afterInit: function(swiper) {
+ slideChange: function(swiper) {
//$this.setClass()
},
- slideChange: function(swiper) {
- console.log(swiper)
+ progress: function(swiper, progress) {
+ //console.log(swiper,progress,(progress*100)+"%")
+
const slides = swiper.slides
let activeIndex = swiper.activeIndex
- let nextAllArray = swiper.slides.slice(activeIndex)
+ let nextAllArray = swiper.slides.slice(activeIndex+1)
let prevAllArray = swiper.slides.slice(0,activeIndex)
- if(nextAllArray.length > 0) {
- nextAllArray.forEach(function() {
+ /*if(nextAllArray.length > 0) {
+ nextAllArray.forEach(function(el,index) {
+ console.log("progress",el.progress)
+ let angle = 4 * el.progress
+ $(el).css({
+ 'transform':'rotate('+(angle)+'deg)',
+ 'top': $this.positionsX[index] ? $this.positionsX[index].top+'px' : 0,
+ })
})
- }
-
- /*$(".bottom-slider .swiper-slide").removeClass("prevSibling nextSibling")
- if($(".swiper-slide-prev").length > 0) {
- const firstPrev = $(".swiper-slide-prev")
- firstPrev.prevAll().addClass("prevSibling")
- }
- if($(".swiper-slide-next").length > 0) {
- const firstNext = $(".swiper-slide-next").next()
- firstNext.nextAll().addClass("nextSibling")
}*/
+
}
}
})
- swiperBottom.on('sliderMove', function (swiper,ev) {
- const direction = swiper.swipeDirection
- let currentSlide = $(swiper.slides[swiper.activeIndex])
- //$this.applyRotationToSiblings()
- });
+
},
+
+ /*setRotation: function(swiper) {
+ let activeIndex = swiper.activeIndex
+ let nextAllArray = swiper.slides.slice(activeIndex+1)
+ let angle = 4
+ if(nextAllArray.length > 0) {
+ nextAllArray.forEach(function(el,index) {
+ $(el).css({
+ 'transform':'rotate('+(angle)+'deg)',
+ 'top': $this.positionsX[index] ? $this.positionsX[index].top+'px' : 0,
+ })
+ angle += 4
+ })
+ }
+ },*/
+
+ confirmTheMatch: function() {
+ let lastIndex = this.swiperBottom.slides.length - 1
+ if(this.swiperTop.activeIndex === lastIndex) {
+ let response = "validate"
+ } else {
+ let response = this.swiperBottom.activeIndex
+ this.swiperTop.slideNext()
+ }
+ }
}
export default QuizMatch;
<span class="access">R</span>
</a>
@endisset
- <a class="btn primary action validate {{ array_key_exists("countdown_enable",$question) ? ($question['countdown_enable'] ? 'countdown' : '') : ''}}"
+ <a class="btn primary {{ isset($matchMaking) ? "confirmMatch" : "action validate" }} {{ array_key_exists("countdown_enable",$question) ? ($question['countdown_enable'] ? 'countdown' : '') : ''}}"
aria-keyshortcuts="Space">
- <span class="text">{{$__('Validate answer')}}</span>
+ <span class="text">
+ @if(isset($matchMaking))
+ {{ $__('Confirm the match') }}
+ @else
+ {{ $__('Validate answer') }}
+ @endif
+ </span>
<span class="access space">{{$__('space')}}</span>
<span class="runningman"></span>
<span data-icon="running-man"></span>
@endisset
</a>
+
@if($data['instantReview'])
<a class="btn primary action none continue" aria-keyshortcuts="Space">
<span class="text">{{$__('Continue')}}</span>