Sunday, September 24, 2006

Improved Super Peek-A-Boo Post

Did you like the Super-Peek-A-Boo post? Then I am sure you will like this improvement as well! After collapsing a post, it auto-scrolls back to the top of the post. That's nice, isn't it? You can see it at work now if you expand and collapse the post you are reading now.

One of the comments I received on the Super Peek-A-Boo post is, that after collapsing a post you end up reading another post, that 'moves up' into view because you collapse the post.

So I sleft a few nights on it, and came up with a very simple solution to this (cosmetic) problem. You need to make 2 slight adjustments.

One is to the 'post'-includable. If you followed my instructions on peek-a-boo posts, you gave the post-body <div> an id. You have to move this id to the top of the includable like this:

<b:includable id='post' var='post'>
<div class='post uncustomized-post-template'
 expr:id='"post-" +' >

We will use this id to scroll back to, so by placing it at the top we assure that we scroll back to the top of the post (and not to the top of the body, which would leave out the post title).

Secondly, we need to adapt the javascript hideFull() function, by adding a tiny line of code at the end:

Thats all to make it work!

In order to adhere to common standards I asked Ramani to update his Hackosphere.js-file to include the new line of code. So be patient until Ramani releases the new file.