homepage Welcome to WebmasterWorld Guest from 54.167.185.110
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
How to get background image to load last?
kapow




msg:1476074
 2:46 pm on Aug 26, 2003 (gmt 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?

 

moltar




msg:1476075
 2:48 pm on Aug 26, 2003 (gmt 0)

You could write a javascript, place it at the end of the page and make it load bg image.

kapow




msg:1476076
 5:27 pm on Aug 26, 2003 (gmt 0)

how does a javascript load a bg image?

killroy




msg:1476077
 5:53 pm on Aug 26, 2003 (gmt 0)

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

just a guess

SN

gph




msg:1476078
 1:34 am on Aug 27, 2003 (gmt 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.

kapow




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

Thankyou

I'll give it a go.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved