December 22nd, 2002

belize

background-attachment: parallax

CSS defines background-attachment which can be scroll or fixed.

I want:
BODY {
  background-image: url(something.jpg);
  background-attachment: parallax;
  background-parallax-ratio: 0.5;
}
(I want my background image to scroll at some ratio of the speed of the text.)

I bet this could be accomplished with some DHTML ... connect document.onScroll to some code which modifies the repeated background vertical offset to (vert_scroll * ratio % image_height) or something.

Somebody make this for me and I'll buy you a present. I have no practical use for it, but I want to see it....

I thought I found it, but this doesn't seem to be it:

http://www.geekcomix.com/snh/files/demos/css-trans/window.html

It doesn't work in Mozilla or IE, nor is it what I want, even if it did work.