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

Archives:
Meta:
September 2017
M T W T F S S
« Mar    
 123
45678910
11121314151617
18192021222324
252627282930  
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’;
}                 

Leave a Reply