Spoiler tags

I finally worked out my spoiler tag system so that it works in Blogger and when feeds are displayed in a feed reader. It's not as pretty as the design I wanted to copy, but it works. Finally.

Script is as follows:

This goes in the css style section:

.spoilerz { color:#ccc; cursor:pointer; }
.despoilerz { color:blue; cursor:pointer; }

This script goes somewhere before </body>:

<!-- spoilerz scripting -->
<script src="http://code.jquery.com/jquery-1.4.4.js"></script>
<script>
$(document)
.ready(function() {
$('.spoilerz')
.live('click', function() {
$(this).toggleClass("despoilerz");
});
});
</script>
<!-- END spoilerz scripting -->

Then the text is formatted as follows:

<div style="color:#ccc; background-color:#ccc;">
<div class="spoilerz">
Text to be spoilerified.
</div>
</div>

Like I said, not brilliant, but it should at least work.

Thus, a test: click on the gray box and all should be revealed...

Please let this work.......

No comments: