twi

script kitty



↓ cohost let me center align this challenge ↓
This user is it. (What is it? It's it)
This user is a host for the fungus.
↑ cohost let me center align these challenge ↑



i'm the body selling robot and i'm always selling bodies

breaking into mausoleums doing something naughty



  • also a cat obvs
  • does art, video, coding, gamedev as executive dysfunction allows
    • (godot, zig, some c/c++/c#. if you need a programmer hmu on twitter or something)
  • 日本語はあまりできませんけど、学ぼうとしています
  • very autistic, probably inattentive adhd
  • θΔ maybe, nonhuman for sure
  • 29 & kink/sex positive, period
  • dni if you: have a dni in bio,
    click here to sexually harass this user

(pfp: actual nitw concept art)


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!


@twi shared with:

You must log in to comment.

in reply to @YellowAfterlife's post: