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

[feat]: Carousel autoplay restart #3653

Open
2 tasks done
kratess opened this issue May 3, 2024 · 1 comment
Open
2 tasks done

[feat]: Carousel autoplay restart #3653

kratess opened this issue May 3, 2024 · 1 comment

Comments

@kratess
Copy link

kratess commented May 3, 2024

Feature description

By default on click on an autoplay carousel it stops but it never restarts.
I'd like to make it restart after a while

Affected component/components

Carousel

Additional Context

No response

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues and PRs
@wontory
Copy link

wontory commented May 4, 2024

You can easily make it restart.

Embla Carousel's docs: https://www.embla-carousel.com/plugins/autoplay/#stoponmouseenter

When enabled, autoplay will stop when a mouse pointer enters the Embla Carousel container. If stopOnInteraction is also false, autoplay will resume when the mouse leaves the carousel container.

import Autoplay from "embla-carousel-autoplay"
 
export function Example() {
  return (
    <Carousel
      plugins={[
        Autoplay({
          delay: 2000,
          stopOnInteraction: false,
          stopOnMouseEnter: true
        }),
      ]}
    >
      // ...
    </Carousel>
  )
}

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

No branches or pull requests

2 participants