Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Re: [Westin] Spoiler code would be really useful.

Quote Reply
Re: [Westin] Spoiler code would be really useful. In reply to
Here's something really basic:

tag:
Code:
spoiler

html:
Code:
<div class="spoiler">
<h4 class="spoiler-title">Spoiler <a href="#" onclick="var sp = this.parentNode.parentNode; var spc; for (var i = 0; i < sp.childNodes.length; i++) { if (sp.childNodes[i].className == 'spoiler-content') { spc = sp.childNodes[i]; break; } } if (spc) { spc.style.display = spc.style.display == 'none' ? '' : 'none' }">(Click to view)</a></h4>
<div class="spoiler-content" style="display: none">

closing html:
Code:
</div>
</div>

markup type: Text Block

Clear spaces: Yes

Ideally, you'd move all that javascript into a separate file and even better would be to use jQuery instead (if you were already using it on your site), and do something like switch it from saying Show, to Hide. And of course style it.

Adrian
Subject Author Views Date
Thread Spoiler code would be really useful. Westin 6507 May 19, 2009, 12:43 PM
Thread Re: [Westin] Spoiler code would be really useful.
brewt 6322 May 19, 2009, 1:21 PM
Thread Re: [brewt] Spoiler code would be really useful.
Westin 6317 May 19, 2009, 1:34 PM
Thread Re: [Westin] Spoiler code would be really useful.
Westin 6326 May 19, 2009, 10:17 PM
Post Re: [Westin] Spoiler code would be really useful.
Westin 6290 May 20, 2009, 3:48 AM