Disappearing text for long posts


OddyBoBo asks and so she receives. I'm a sucker for a damsel in distress(even if she didn't model the tight sweater & scarf). She's asked for a way to Show / Expand text in posts. I started out with the information from Blogger Help which expands the the entire article if you follow it word for word. Below are the instructions that will allow you to Show / Hide parts of a long post.

You first have to make a couple of additions to your template.

Template Modifications:
somewhere between the <style> and </style> tags add the following two lines:
.posthidden {display:none}
.postshown {display:inline}

After the </style> tag and before the </head> tag paste the following function.


<script type="text/Javascript">
function expandcollapse (postid) {
whichpost = document.getElementById(postid);
if (whichpost.className=="postshown") {
whichpost.className="posthidden";
}
else {
whichpost.className="postshown";
}
}
</script>

Now when you want to Show / Hide Part of a Post you will add the following code after the start of your post:

Here is the beginning of your post, at the expansion point insert the following code:

  <span class="posthidden" id="UniqueID">

Here is the rest of your post.
It could be text or pictures that aren't work safe.
Like a woman Modeling a Sweater and Waving a Scarf.
Then at the end of the post be sure to put this text or it won't work.

  </span><a href="javascript:expandcollapse('UniqueID')">

[+/-] show/hide this post</a>


[+/-] show/hide this post

Clear as mud?

Any questions sent hate mail or leave a nasty comment.

Currently in blogger I can't find a way to automate the UniqueID portion so you'll have to start a list of your own. My recommendation would be to use a numeric value and increase it by one each time.

Update: Mustang 23 of Assumption of Command made the following suggestion in the comments.

I based my Unique ID on the Date of the post.
For example

DDMMMYY#
27MAR051

Where # is the order that I createthem for that day. this way you won't have to remember which uniquie IDs you have used

This makes sense to me and it from everything I've found the past couple of days blogger doesn't allow access to the Post#.

Posted by phineas g. at 02:32 PM on March 25, 2005
Comments