Here's something really basic:
tag:
html:
<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:
</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
tag:
Code:
spoilerhtml:
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