Skip to content

[Help]: "stopOnInteraction: false" failing to re-enable autoplay after interaction #866

Closed Answered by sarussss
ItsFrankieD asked this question in Help
Discussion options

You must be logged in to vote

Hi @ItsFrankieD

Your problem is that you are writing the autoplay options together with the slider options
Please write the autoplay plugin options separately.

Replace

((EmblaCarousel, EmblaCarouselAutoplay) => {
  const hero = document.querySelector(".hero");
  const slides = hero.querySelectorAll(".hero__item");

  if (slides.length <= 1) {
    return;
  }

  const options = {
    loop: true,
    duration: 40,
    slides: slides,
  };
  

  const optionsAutoplay = {
    delay: 6500,
    stopOnMouseEnter: true,
    stopOnInteraction: false,
  };

  const carousel = EmblaCarousel(hero, options, [EmblaCarouselAutoplay(optionsAutoplay)]);
})(EmblaCarousel, EmblaCarouselAutoplay);

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@ItsFrankieD
Comment options

@davidjerleke
Comment options

@ItsFrankieD
Comment options

@sarussss
Comment options

Answer selected by ItsFrankieD
@ItsFrankieD
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
resolved This issue is resolved question Question about how to achieve something
3 participants