this.offsetLeftItemDragged = 0
this.offsetRightItemDragged = 0
this.initQuestion();
+ this.value_ = 0
let height_ = 400 - $(".card-holder").parent().find(".text").height()
document.documentElement.style.setProperty('--height-zone', height_+'px');
//
if (slot) {
let rules = {
- width: slot.w,
- height: slot.h,
+ width: "60%",
+ height: "60%",
x: slot.x,
y: slot.y,
fontSize: "12px",
scale: 1, duration: 0, immediateRender: true
})
+ //
+ $this.setOpacityZone(this.target,direction)
+
//set rotation on desktop
if (!$this.quiz.resize.isMobile()) {
$this.rotateItem(this, direction)
//
$(".zone-1,.zone-2").addClass("notDrag")
+ //
+ document.documentElement.style.setProperty('--opacity-zone-1', '0');
+ document.documentElement.style.setProperty('--opacity-zone-2', '0');
+
//
$this.leaveZone()
return zone
},
+ setOpacityZone: function (target,direction) {
+ let $this = this
+ var rectSelection = target.getBoundingClientRect();
+ var listRect = $this.list.get(0).getBoundingClientRect()
+ let value = 0;
+ let zone = '';
+
+ if (direction.includes("left") || direction.includes("up")) {
+ var rect = document.querySelector(".zone-1 .zone-content").getBoundingClientRect()
+ value = direction === "up" ? 100 - ( (rectSelection.top - rect.bottom) / (listRect.top - rect.bottom) ) * 100 :
+ 100 - ( (rectSelection.left - rect.right) / (listRect.left - rect.right) ) * 100
+ zone = "--opacity-zone-1"
+ } else {
+ var rect = document.querySelector(".zone-2 .zone-content").getBoundingClientRect()
+ value = direction === "down" ? 100 - ( (rectSelection.bottom - rect.top) / (listRect.bottom - rect.top) ) * 100 :
+ 100 - ( (rectSelection.right - rect.left) / (listRect.right - rect.left) ) * 100
+ zone = "--opacity-zone-2"
+ }
+ value = Math.max(0, Math.min(value, 100)) / 100;
+ document.documentElement.style.setProperty(zone, value);
+ },
+
measureSizes: function () {
this.ww = $(window).width();
this.hh = $(window).height();
getSlotInformations: function (zone) {
let a = this.getAreaElement(zone);
- let freeSlot = $(a).find('.slot:not(.active)')
- if (freeSlot.index() > 5) {
+ let freeSlot = $(a).find('.text')
+ /*if (freeSlot.index() > 5) {
freeSlot = $(a).find('.slot:nth-child(6)')
- }
- freeSlot = freeSlot.eq(0);
+ }*/
+ //freeSlot = freeSlot.eq(0);
let freeSlotRect = $(freeSlot).get(0).getBoundingClientRect();
let listRect = this.list.get(0).getBoundingClientRect();
let scale = this.quiz.resize.scale
+@use 'sass:color'
+
[data-type="draganddrop"]
.fill-area
background-color: $standard-fill-area
&.zone-1
.zone-content
- left: 24px
+ &:before
+ opacity: var(--opacity-zone-1)
+ .m &
+ left: 50%
+ top: 0
+ .text
+ padding-left: 24px
+
+
&.zone-2
text-align: right
left: initial
right: 0
-
img
position: absolute
right: 0
height: 252px
.zone-content
- right: 24px
+ right: 0
+ &:before
+ transform: translate(0,-50%)
+ opacity: var(--opacity-zone-2)
+ .m &
+ transform: translate(-50%,-50%)
+ left: 50%
+ top: 100%
+
+ .text
+ padding-right: 24px
.zone-content
position: absolute
- bottom: 106px
width: 180px
- height: 400px
- +flex-config(space-between,false,column,false)
+ height: 100%
+ +flex-config(center,false,column,false)
+
+ &:before
+ content: ""
+ left: 0
+ width: 200%
+ height: 200%
+ position: absolute
+ top: 50%
+ background: radial-gradient($accent-color, transparent, transparent)
+ transform: translate(-50%,-50%)
+ transition: opacity .3s
&.active
.card-holder
+opacity(.2, background-color, $texts-color)
-
.card-holder
overflow: hidden
height: var(--height-zone)
-
.m &
display: none
.text
- margin-bottom: 21px
-
+ position: relative
h2
font-size: 20px
margin-bottom: 8px