Testing the Show / Hide JavaScript for Blogger
For long posts, I want to be able to have people see the first paragraph or so of a post, and then have a link that calls a JavaScript script to reveal the next paragraph.
This is a simple CSS / DOM trick, and the
blogger help pages describe one way to do it.
However, the blogger help pages show you how to use it when you want it to apply to all of your posts. If you just have a few longs posts, you need to adapt it.
What I did was to take the same JavaScript:
function expandcollapse (postid) {
whichpost = document.getElementById(postid);
if (whichpost.className=="postshown") {
whichpost.className="posthidden";
} else { whichpost.className="postshown";}
}
</script>
And the CSS that were provide in the help page:
.posthidden {display:none}
.postshown {display:inline}
And simply create my own span, with a made up id in the post.
Do a view source on this post to see how it works.
[+/-] Expand / Collapse this section