Webmaster Forum

Go Back   Webmaster Forum > Web Development > Web Design Lobby

Web Design Lobby Forum for general web design issues not specific to scripting or graphics.


Reply
 
LinkBack Thread Tools Display Modes
Old 02-11-2009, 06:26 AM   #1 (permalink)
Junior Member
 
Join Date: 07-06-08
Posts: 23
iTrader: 0 / 0%
Latest Blog:
None

bryzo is liked by many
Show entire background image to user

I would like to place a background image on my website...but I want the entire image to be viewable to the user, no matter what the size of their browser is.....so how do I have the image autoresize depending on the size of the browser window?

Tanks!
bryzo is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-17-2009, 09:34 PM   #2 (permalink)
Contributing Member
 
Join Date: 02-16-09
Posts: 61
iTrader: 0 / 0%
Latest Blog:
None

sssharlasss is liked by many
You're not going to be able to do this in CSS, but it can be achieved with JavaScript.

Create a layer (for the background image) to go beneath
the existing content and resizing the image according to the screen
width.

bgimg = document.createElement("bgimg");
bgimg.src = "/images/bg.jpg";
st = {
position:"absolute",
zIndex:"-10",
width:screen.width,
top:"0",
left:"0"
}
for( s in st ){
img.style[s] = st[s];
}
document.body.appendChild(bgimg);

Bada-bing, bada boom.
__________________
I tasted too what was called the sweet of revenge - but it was transient, it expired even with the object, that provoked it.
-Ann Radcliffe

| FontStruct | WonderfulProject Amazon Deal Finder |
sssharlasss is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-18-2009, 08:15 PM   #3 (permalink)
Junior Member
 
Join Date: 02-02-09
Posts: 10
iTrader: 0 / 0%
Latest Blog:
None

rrjnsy89 is liked by many
Pretty smart to use a layer for that, I would’ve thought that could have been achieved on CSS, but you’re the master.
rrjnsy89 is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Splitting background image cmg433 Coding Forum 6 07-18-2008 07:33 PM
CSS Background Image Problem Boogle Web Design Lobby 8 09-05-2007 05:44 AM
CSS background image IE paranoidandroid Coding Forum 3 06-04-2006 01:28 PM
Still Background Image TheGunslinger Web Design Lobby 3 08-09-2005 08:00 PM
Table Background Image Jazzee Coding Forum 5 11-16-2003 09:05 PM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 09:53 PM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.