},
on: {
slideChange: function(swiper) {
- //$this.setClass()
+ $this.setRotation(swiper)
},
progress: function(swiper, progress) {
- console.log(swiper)
-
- const slides = swiper.slides
- let activeIndex = swiper.activeIndex
- let nextAllArray = swiper.slides.slice(activeIndex+1)
- let prevAllArray = swiper.slides.slice(0,activeIndex)
-
-
- console.log(nextAllArray)
- //console.log(prevAllArray)
- let angle = 4
-
- if(swiper.swipeDirection === "next") {
- angle -= 4
- }
-
- if(nextAllArray.length > 0) {
- let angle = 4
- nextAllArray.forEach(function(el,index) {
- console.log("progress",el.progress,progress)
-
- $(el).css({
- 'transform':'rotate('+(angle)+'deg)',
- 'top': $this.positionsX[index] ? $this.positionsX[index].top+'px' : 0,
- })
- angle += 4
-
- })
- }
-
+ $this.setRotation(swiper)
}
}
})
},
- /*setRotation: function(swiper) {
+ setRotation: function(swiper) {
+ const $this = this
+ const slides = swiper.slides
let activeIndex = swiper.activeIndex
let nextAllArray = swiper.slides.slice(activeIndex+1)
+ let prevAllArray = swiper.slides.slice(0,activeIndex)
+
+
+ console.log(nextAllArray)
+ //console.log(prevAllArray)
let angle = 4
+
+ if(swiper.swipeDirection === "next") {
+ angle -= 4
+ }
+
+ if(prevAllArray.length > 0) {
+ let angle = -4
+ prevAllArray.reverse().forEach(function(el,index) {
+
+ $(el).css({
+ 'transform':'rotate('+(angle)+'deg)',
+ 'top': $this.positionsX[index] ? $this.positionsX[index].top+'px' : 0,
+ })
+ angle -= 4
+
+ })
+ }
+
if(nextAllArray.length > 0) {
+ let angle = 4
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.swiperTop.slides.length - 1