let x = $(".list-item").offset().left
+ let zone1 = $(".zone-1 .zone-content")
+ let zone2 = $(".zone-2 .zone-content")
+ let widthList = $(".list-item").width()
+
Draggable.create(".list-item", {
type: "x,y",
edgeResistance: 0.2,
inertia: true,
bounds: ".list",
+ liveSnap: {
+ //quiz.js:1328 393 333.5
+ points: {x: [393], y: [333.5]},
+ radius: 1
+ },
onMove: function() {
- console.log('ok')
+ let left = $(this.target).offset().left,
+ right = $(this.target).offset().left + $(this.target).outerWidth(),
+ direction = this.getDirection(),
+ rotation = 0
+
+ //set rotation
+ if(direction.includes("right")) {
+ rotation = 5
+ } else {
+ rotation = -5
+ }
+
+ if(this.endX === 0) {
+ rotation = 0
+ }
+
+ gsap.to(this.target, {
+ rotation: rotation
+ })
+
+
+ //
+ if(left - 19 < zone1.offset().left + zone1.width()) {
+ $(".zone-1").addClass("active")
+ } else {
+ $(".zone-1").removeClass("active")
+ }
+
+ if(right + 19 > zone2.offset().left) {
+ $(".zone-2").addClass("active")
+ } else {
+ $(".zone-2").removeClass("active")
+ }
+
+ //let listHalf = $(".list-item").width
+ },
+ onRelease: function() {
+ //
+ $(".zone-1,.zone-2").removeClass("active")
+
+ // reset list rotation
+ gsap.to(this.target, {
+ rotation: 0
+ })
}
});
},
right: 0
.zone-content
right: 24px
+
+ &.zone-1,
+ &.zone-2
+ &.active
+ .zone-content
+ +opacity(.2,background-color,$texts-color)
+
.zone-content
position: absolute
top: 50%
transform: translateY(-50%)
width: 100%
max-width: 180px
- .text
- margin-bottom: 21px
-
- form
- +opacity(.08,background-color,$texts-color)
- +radius(16px)
+ height: 70%
padding: 8px
border: 1px dashed rgba($texts-color,.4)
+ +radius(16px)
+ transition: background-color .2s ease
+
+ .text
+ margin-bottom: 21px
.slot
width: 100%
height: 51px
- border: 1px solid rgba($texts-color,.24)
+ //border: 1px solid rgba($texts-color,.24)
+radius(8px)
.screen
opacity: 0 !important
visibility: hidden
+ &[data-direction=right]
+ transform: rotate(25deg)
+ &[data-direction=left]
+ transform: rotate(-25deg)
.controls
width: 124px
<div id="instantReviewAnimation"></div>
</div>
</div>
+<div id="vertical-1" style="position: absolute; height: 100vh; width: 1px; top: 0; left: 1356px; z-index: 999; background: #FFFFFF;"></div>
<script src="js/quiz.js"></script>
<script>
function changeViewportSize () {