ann-arcana

Queen of Burgers 🍔

Writer, game designer, engineer, bisexual tranthing, FFXIV addict

OC: Anna Verde - Primal/Excalibur, Empyreum W12 P14

Mare: E6M76HDMVU
. . .



YellowAfterlife
@YellowAfterlife

First, let's see what you get.

Once upon a time, I stumbled upon ct.js, a game engine with a number of features and also a very pleasant-looking cat mascot. It also came to my attention that the SVG for the mascot is available on GitHub. Me being me, several minutes passed between me downloading the SVG file and getting an idea, and subsequent edits continued both to mine and friends' amusement.

An image of the ct.js mascot, a sort of blue blob-cat. It is smiling.
<
>
With power of Inkscape, the cat now is now holding a knife in its paw.
<
>
The cat now has two knives.
<
>
The cat is now holding a knife with its tail as well.
<
>
There is now a second, smaller cat, with its own knife. The knife is too big. The cat grips onto it with both of its little paws
<
>

And here's the generator: https://yal.cc/tools/cohost/gallery-generator/
You can download the page and mess with it as you may - it's written in plain ES6.
You can also export either plain HTML or HTML with classes for prechoster.

Here's it works:

After experimenting with anchor tricks I decided that I might, in fact, do something with the <details> tag for once. So I did:

The gallery is a <div> (surely enough) that has position: relative and overflow: hidden (just in case). The first image simply sits in the div and sets the overall dimensions+aspect ratio.

Then come the summary+details tricks:

The "next" button is the <summary>.

When you click it, we can display the next page on top of the container, but then we wouldn't be able to go back (which is only possible by clicking the button again), so the button needs to move.

The easiest way is to simply have something in the <details> that pushes the button away once expanded, so I've put it in the right-aligned container and added an invisible element that's button+spacing wide.

The "previous" button is then shown on top of summary-button, but remains click-through thanks to pointer-events: none.

Images with their own controls sections can be nested indefinitely, adding about 0.6KB of markup per layer.

Have fun!


You must log in to comment.

in reply to @YellowAfterlife's post: