#setInterval support for dynamic image change every second

2 messages · Page 1 of 1 (latest)

lucid rune
#

I want to implement dynamic image change every second (alias static slideshow) like some fancy creative agency website in Astro via SolidJS UI framework.

But the question is, is Astro support setInterval() in SSG mode? Because I've tried to implement them via SolidJS but the image index doesn't change.

jolly coral
#

Yes, easy answer is, if you can do it outside Astro, that means you can do it with Astro. But first, you might have to take a look on how Astro works, specifically the usage of plain vanilla js script in a script tag, see client side js https://docs.astro.build/en/guides/client-side-scripts/
Client side scripts are sent to the user and run in the browser so do not differ between SSG and SSR.