Welcome to WebmasterWorld Guest from 50.16.24.12

Forum Moderators: open

How to get background image to load last?

   
2:46 pm on Aug 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm working on a site that requires a large background image. Is it possible to get the page content to load first and then have the background image load?
2:48 pm on Aug 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could write a javascript, place it at the end of the page and make it load bg image.
5:27 pm on Aug 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



how does a javascript load a bg image?
5:53 pm on Aug 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



body.style.background-image="/image.jpg"

just a guess

SN

gph

1:34 am on Aug 27, 2003 (gmt 0)

10+ Year Member



Close killroy

onload = function() {
document.body.style.background = 'url(my.jpg)'
document.body.style.backgroundRepeat = 'no-repeat'
document.body.style.backgroundPosition = 'center center'
}

Notice that everything is the same as in CSS except multiple word properties use capital letters on words other than the first and the "-" is removed.

Also, you can combine styles in one declaration the same way that you would in CSS.

9:50 am on Aug 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thankyou

I'll give it a go.

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month