this.initQuestion();
},
- sendCurrentAnswerToArea: function (area) {
+ sendCurrentAnswerToArea: function (area, index) {
if (this.animating === true) {
return;
}
- this.quiz.screens.currentQuestionAnswers.push(area === 'zone-1' ? 1 : 2);
+ //this.quiz.screens.currentQuestionAnswers.push(area === 'zone-1' ? 1 : 2);
+ console.log("index",index)
+ this.quiz.screens.currentQuestionAnswers.splice(index, 0, area === 'zone-1' ? 1 : 2)
this.animating = true;
const $this = this;
position: 'absolute',
}
if (this.quiz.resize.isMobile()) {
-
rules = {
scale: 0.8, duration: .3, autoAlpha: 0,
}
//
let zone = $this.getZoneOverlap(this.target)
if (zone) {
- $this.sendCurrentAnswerToArea(zone);
+ $this.sendCurrentAnswerToArea(zone, $(this.target).data("id"));
}
},
onRelease: function () {
this.createDraggable(this)
let tl = gsap.timeline()
this.quiz.animations.animateDragAndDropCarrousel(tl)
- },
+ }
}
export default QuizDragAndDrop;
<div class="screen question-draganddrop">
@include('screens.arrow',['side'=>'left','action'=>'move-card'])
<ul class="list">
- @foreach($question['answers'] as $key => $answer)
- <li class="list-item {{ $key === 0 ? 'current' : '' }}" data-id="{{$key}}">
- <h4>{{$answer['answer']}}</h4>
- <p>{{$answer['answer_text']}}</p>
+ @php
+ $keys = array_keys($question['answers']);
+ shuffle($keys);
+ @endphp
+ @foreach($keys as $index => $key)
+ <li class="list-item {{ $index === 0 ? 'current' : '' }}" data-id="{{$key}}">
+ <h4>{{$question['answers'][$key]['answer']}}</h4>
+ <p>{{$question['answers'][$key]['answer_text']}}</p>
</li>
@endforeach
<li class="overlay"></li>