Animated Floating Sidebar

I wrote this the other day and thought it was worth posting here. It is Javascript that will allow you to float a div that moves up and down as the user scrolls the webpage in the browser window. It will speed up and animate faster if the user scrolls quickly from spot to spot or slower if they scroll slowly.

Here is the Javascript.

<script type="text/javascript">
/**
 * Animates a floated div to move up and down with the scrolling of the page.
 *
 * More details at http://www.finefrog.com/2007/12/14/animated-floating-sidebar/
 *
 * @author Jordon Mears <jordoncm at gmail dot com>
 */
function animate_box() {
    var offset = 0; /* set this to the starting margin-top in the css */
    var element = document.getElementById('animate_box');

    if(element) {
        var top = Number(String(element.style.marginTop).substring(0, String(element.style.marginTop).indexOf('px')));

        var difference = (document.documentElement.scrollTop + offset) - top;

        if(difference > 0) {
            element.style.marginTop = (top + Math.abs(Math.ceil(difference / 10))) + 'px';
        } else if(difference < 0) {
            element.style.marginTop = (top - Math.abs(Math.ceil(difference / 10))) + 'px';
        }
    }
}
window.setInterval(animate_box, 50);
</script>

Here is the div. Since it is just a float, you can easily embed it inside other elements.

<div id="animate_box" style="float: right;">I am an animated div that scrolls with the browser window.</div>

Click here to see an example of it at work.

It works in all standard compliant browsers and Internet Explorer 6+ (maybe even older).

You are welcome to use this for whatever you want; I just ask that you retain the credits (and maybe leave me a comment).

Mailplane for Mac OSX Invitations

Mailplane is OSX application that provides a front-end for Gmail on Mac. I have been using it for a while now and I like it pretty well. I like it because it is isolated from Mail.app and it integrates natively into Growl. It also makes attachments and managing more than one Gmail account easier.

Anyway, I have some invitations for the beta testing program and really no one to give them too, so I thought I would offer it to anyone that was interested. I really want to delete the email that allows me to invite people, but I don’t want the invitations to go to waste. If you would like an invitation, please just post a comment here.

You can find more about the application at:
http://www.mailplaneapp.com

Apple ][ Emulation

I was listening to the RetroMacCast this week and they were talking about the old Apple ][, which was the very first computer I ever owned. It got me in the mood of getting in front of one again; however I haven’t seen one since sometime in the mid 90’s.

Thankfully there is some pretty good emulation software out there.

KEGS (http://kegs.sourceforge.net)

This is the first one I tried but it is a bit more complex to get running, so I quickly abandoned it. However it does work on Windows and Linux as well as OSX.

OSXII (http://apple2.intergalactic.de/intergalactic.de/Software.html)

This one was really easy to setup, however more limited than KEGS. But it was good enough for me.

I got to play around on some really old games, and also try to remember how to write animations for GraFORTH ][. I think I got my fix for another decade or so.

{
}