← Back to context

Comment by autoexec

3 hours ago

That at least is a pretty reasonable use of js to display an image. The page WarOnPrivacy linked to only had a single static image to display, even used an img tag, and still managed to make it impossible to view without javascript enabled.

I've pretty much given up on first-party scripts and only care about data being sent out these days. However it's entirely possible to make a reactive image carousel with navigation and drag/swipe control in pure HTML and CSS these days, there's no need for JavaScript to do this. It should even be possible to make it auto play with CSS animations.

Issues: - I would avoid autoplay without JavaScript--the only way to make it pause is with hover-state (animation-play-state), it's not possible to start/stop permanently without scripting afaik, though you could make it only auto-play when the cursor is within the borders but not over a button. This is solvable with scripted buttons. - using anchors as bookmarks will snap page scroll to them when you click. Scroll containers and scroll markers[1] proposes to fix this (see the link at the top of the article below), but it's still implemented only in chromium-based browser. This is also solvable with a small amount of JavaScript.

See https://css-tricks.com/css-only-carousel/ (the auto-play once didn't work for me, but see caveat above regarding automatic play without scripting).

[1]: https://caniuse.com/wf-scroll-markers