In 2013, I implemented a “spoiler” feature in my book list pages.
It was a bit clunky, making a jolting page shift to display the hidden spoiler text.
I recently reimplemented the technique. I’m happier.
If you are interested, check the description of how it was done.
The core JavaScript code was:
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == ‘block’)
e.style.display = ‘none’;
else
e.style.display = ‘block’;
}