Welcome to WebmasterWorld Guest from 54.159.19.75

Forum Moderators: open

Message Too Old, No Replies

How to get background image to load last?

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2001
posts:1281
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 18, 2003
posts:1925
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2001
posts:1281
votes: 0


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

Senior Member from MT 

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 1, 2003
posts:1843
votes: 0


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

just a guess

SN

gph

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

Full Member

10+ Year Member

joined:Jan 31, 2002
posts:285
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2001
posts:1281
votes: 0


Thankyou

I'll give it a go.