Well, that was fun, thanks!
Hope you don't mind me taking the liberty of using percentages to make my life a little easier and maybe the script a little more reliable as I can reliably use a float with percentages.
What I did was that the layout, html and css follow the rules that you need for proper bg animation, they remained basically the same as yours.
Then it was only about calculating the calculations necessary for the correct properties, to determine the percentage that you were on top, *20
actually represents the number of spaces "left" to fill the background image in percent (since the background height is 80% )
I moved the calculations to a function so that I could call this when scrolling and resizing the window, making sure it is triggered on any event that somehow changes the window ...
Didn't do extensive testing, but worked in Chrome and I'm tired: p
I believe this is what you are looking for:
http://jsfiddle.net/sg3s/RSqrw/15/See edit 2
If you want a different way to draw, just start the beginning of the background of the page at the top and change this:
http://jsfiddle.net/sg3s/RSqrw/14/ See edit 2
Edit:
As a bonus, and since I never wrote a jquery script as a "plugin", I decided to convert it to one. What I came up with should be easy to use and use!
http://jsfiddle.net/sg3s/RSqrw/52/ See Edit 3
Functionality successfully tested in Chrome mode, Firefox 3.6, IE9 +
Edit 2:
After reading the question again, checking whether I did it correctly, I noticed that I didnโt quite do what you need, so I updated the link in the first edit, in which you can add a plugin in which you can have several options for scrolling the background It preserves my โoldโ interpretation, and also does what you want ... Read comments in the code for some additional descriptions.
Edit 3:
As I started working today, I was concerned about the fact that my plug-in "try" was a bit bloated. And, as you mentioned in the commentary, this did not quite meet the requirements.
So, I rewrote it just to do what you want, and not much more, tested in Chrome Firefox, IE9 +, etc. etc. This script is much cleaner.
http://jsfiddle.net/sg3s/vZxHW/
You can choose to have the background stick on top or bottom if the height fits into the window. Nothing else, but this is more than enough to make some pretty cool stuff: p