Skip to content

Commit

Permalink
feat(effect-cards): support for use with Virtual Slides
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Feb 26, 2022
1 parent abe0fec commit 69a8870
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/modules/effect-cards/effect-cards.js
Expand Up @@ -35,18 +35,22 @@ export default function EffectCards({ swiper, extendParams, on }) {

let tXAdd = 8 - Math.abs(progress) * 0.75;

const slideIndex =
swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.from + i : i;

const isSwipeToNext =
(i === activeIndex || i === activeIndex - 1) &&
(slideIndex === activeIndex || slideIndex === activeIndex - 1) &&
progress > 0 &&
progress < 1 &&
(isTouched || swiper.params.cssMode) &&
currentTranslate < startTranslate;
const isSwipeToPrev =
(i === activeIndex || i === activeIndex + 1) &&
(slideIndex === activeIndex || slideIndex === activeIndex + 1) &&
progress < 0 &&
progress > -1 &&
(isTouched || swiper.params.cssMode) &&
currentTranslate > startTranslate;

if (isSwipeToNext || isSwipeToPrev) {
const subProgress = (1 - Math.abs((Math.abs(progress) - 0.5) / 0.5)) ** 0.5;
rotate += -28 * progress * subProgress;
Expand Down

0 comments on commit 69a8870

Please sign in to comment.