more ramblings of a retired teacher
commenting (maybe ranting) on education - even my own
Categories:

Archives:
Meta:
April 2024
M T W T F S S
« Mar    
1234567
891011121314
15161718192021
22232425262728
2930  
08/22/13
Implementing a Spoiler
Filed under: P2PU, coding/programming
Posted by: Algot @ 2:36 pm

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’;
}                 

Comments are closed.