.:∴ Archives ∴:.
Tierra Verde

Tuesday, November 25

Create Spoilers in Blog Posts. ~ Tips for Bloggers  


Create Spoilers in Blog Posts. ~ Tips for Bloggers
Copy and paste this Javascript code between </head> and ]]></b:skin> tags in your template on the Edit Html subtab of Template tab :

<script type="text/Javascript">
function togglecomments (postid) {
var whichpost = document.getElementById(postid);
if (whichpost.className=="commentshown") { whichpost.className="commenthidden"; } else { whichpost.className="commentshown"; }
} </script>

Save Template.

ADD CSS CODE
Then add the CSS code below :

.commenthidden {display:none;}
.commentshown {display:inline;}

just above the ]]></b:skin> tag in the template and Save Template.

ADD CODE TO POST TEMPLATE

Add the following code to the post template in the Settings----->Formatting tab. Then the code will be available to you whenever you are creating a new post :

<a aiotitle="click to expand" href="javascript:togglecomments('NAMEITHERE')"> expand </a>

<div class="commenthidden" id="NAMEITHERE">
PUT HIDDEN TEXT HERE
</div>

Give it an unique name where it says NAMEITHERE and change "expand" to what ever you like.
Neet to think about implementing this. Implementing this as some kind of PHP "macro" would be better. <?PHP spoiler(ID,"text to hide") ?> ID might even be optional, and be replaced with a random number. I'll post if and when I get it written up.

Relevant Link

Permanent link posted by bytehead @ 11/25/2008 08:05:00 PM   Edit this entry 0 comments Links to this post

0 Comments:

Post a Comment

Links to this post:

Create a Link

 

Article Index

Create Spoilers in Blog Posts. ~ Tips for Bloggers
Copyright © 2003-2009, Bryan Price. Licensed by Creative Commons License: Creative Commons License
Home| This page| Colophon| Disclaimer| Privacy Statement