Jump to content
xisto Community
Sign in to follow this  
ExplosioN

Background Resize

Recommended Posts

Does anyone have the javascript for a background to resize? I want my background to resize to 1024x768 if the visitor has resolution 1024x768, to 800x600 if the resolution is 800x600 etc.Greets,ExplosioN :D

Share this post


Link to post
Share on other sites

I think you can do it w/o javascript. Just make one for 1024x768, but make it so if it were to be seen in 800x600, it wouldnt be noticable. I've seen it done before. The layout would have to be aligned to the left, while the background would take care of the right side.

Share this post


Link to post
Share on other sites

If you find the site could you please tell me to as I would like to know how to do this too. I'll join the search for this script too.

Share this post


Link to post
Share on other sites
Here is the answer that has evaded you X2! Your welcome.Background Resize

There iare numerous ways this can be done.  Make sure on either method to change the image to your background of course.  Here are two different ways I just happen to have in my documents at the moment:

<script language="JavaScript1.2">

if (document.All||document.GetElementById)Document.Body.Style.Background="url('YourIMG.Jpg') white center no-repeat fixed"

</script> 

As you probably figured the script goes at the start of your body (inside of the body tags of course).

This is actually ment to give you a watermark effect so your background doesnt scroll but it will also work for your resizing issue. Here is another way to do it using div's:

<div style="position:absolute; width:100%; height:100%; margin:0px; padding:0px; left:0px; right:0px;z-index:1"> <img src="YourIMG.Jpg" width="100%" height="100%"></div>

<div style="z-index:2; position:absolute; margin:0px; padding:0px; height:100%; width:100%; overflow:scroll;">

<p> </p> <p>THIS IS THE CONTENT</p>

</div>

-reply by Eric Backer

 

Share this post


Link to post
Share on other sites

I dont remember coming across a javascript that enable to you to detect the screen resolution. I would like to know if there is one. As suggestion, why not create a website with a liquid width? In that case, you need not worry abt the screen resolution of your users.

Share this post


Link to post
Share on other sites

I dont remember coming across a javascript that enable to you to detect the screen resolution. I would like to know if there is one. As suggestion, why not create a website with a liquid width? In that case, you need not worry abt the screen resolution of your users.


Hey there,

you don't actually need a specific code to detect resolution you can just put it in an if/else clause

if((screen.width==1280)&&(screen.height==800)) document.write('<style type="text/css">body {background:url(http://forums.xisto.com/no_longer_exists/);background-attachment: fixed;}"></style>')

hope this helps

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.