When you need to shuffle elements but want to keep your (Kirby) cache, here's a simple frontend solution:
@medienbaecker Hey, nice one! But this caught my eye:
> To avoid seeing the original order briefly before JS runs, we hide the elements initially
Unfortunately, the `scripting: enabled` media feature doesn’t work like that. It will only match if JS is disabled or not supported, more like <noscript>.
It means that it’s true while JS is still loading and it’s true if it fails to load. The only reliable solution is the class="no-js" on the root element that you remove with loaded JS.
@pepelsbey You're right, the headline of that section is misleading. I'm using the data attribute to prevent the flash of unsorted content, not the media query. The media query is only there to keep images visible for users with JavaScript disabled. So in this case it's good it also works while JS is still loading. :)
I just added an explanation. Thanks for the feedback!