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
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it