Menu
Hello, I’m trying to write a script to adjust the width of a background image to fit perfectly in any window size.
This is the way I have my background set up.
BODY { background-image:url(layout3.jpg);
background-repeat:no-repeat;
background-position:bottom right;
background-attachment:fixed }
I can determine the width of the window with document.body.clientWidth. But how can I change the width of the background image to reflect this value? I’m thinking of adding it to a javascript function on a 10 millisecond timer, so that it reacts immediately as soon as a window is resized.