Carousel random start image
-
Hello,
Is it possible to have always a different image in the carosel after load page, but the sequence of images following it will remain? I know there is a random order but it completely mess up the order. I'm looking more for a random start image.Thanks in advance
Andrej -
Dear @andrej
this is not possible. We are sorry.
Best!
Marius -
Hey @mariusjopen,
Does anything speak against an approach like this, invoking https://swiperjs.com/swiper-api#method-swiper-slideTo?
window.laytheme.on("newpageshown", function(){ setTimeout(() => { const swiper = document.querySelector('.swiper-container').swiper; swiper.slideTo(randomIndex, 0, false); }, 50); }); -
Hey @Richard,
Thanks. Yes, it's working. The only issue is that the necessary delay of setTimeout is a guessing game. Because layCarousel.initModule(), which calls new Swiper(), itself gets called on newpageshown().
Feature suggestion: It would be nice to have another event exposed that runs once the carousel (or all addons) are initialized. That way we wouldn't have to rely on setTimeout to access swiper. In the case of Swiper, it could use https://swiperjs.com/swiper-api#event-init.
-
Dear @brogr
Thank you for the feedback it has been noted ✅
Feature suggestion: It would be nice to have another event exposed that runs once the carousel (or all addons) are initialized. That way we wouldn't have to rely on setTimeout to access swiper. In the case of Swiper, it could use https://swiperjs.com/swiper-api#event-init.
Have a great day 🌝
Richard