Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do i change the scale of the unselected cards? #73

Open
Tacciaioli opened this issue Jan 9, 2024 · 2 comments
Open

How do i change the scale of the unselected cards? #73

Tacciaioli opened this issue Jan 9, 2024 · 2 comments

Comments

@Tacciaioli
Copy link

No description provided.

@napatsa
Copy link

napatsa commented Mar 26, 2024

+1

@loisperrigon
Copy link

loisperrigon commented Oct 4, 2024

Hey :)

<Carousel
  slides={slides}
  goToSlide={goToSlide}
  offsetRadius={offsetRadius}
  showNavigation={false}
  animationConfig={config.slow}
  offsetFn={(offsetFromCenter) => {
    // If offsetFromCenter is 0, the element is centered
    if (offsetFromCenter === 0) {
      return {
        opacity: 1, // Full opacity for the central element
        transform: "translateY(-50%) translateX(-50%) scale(1)",
        left: "50%", // Keeps the element in the center with normal scaling
      };
    }

    // If the offset is negative, the element is on the left; otherwise, it's on the right
    const isLeft = offsetFromCenter < 0;

    return {
      opacity: 1, // Keeps opacity constant
      transform: isLeft
        ? "translateY(-50%) translateX(-30%) scale(0.75)" // For elements on the left
        : "translateY(-50%) translateX(-70%) scale(0.75)", // For elements on the right
    };
  }}
/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants