If I were adding this to a real web page I'd use unobtrusive event listeners and make use of the id on the div to attache them.

AussieJohn
—
2012-10-31T08:34:43Z —
#3

rpeg, I've seen something like this implemented using a jQuery plugin called "Waypoints" - if you don't mind using jQuery on your site, it might be worth taking a look at their demo page: http://imakewebthings.com/jquery-waypoints/