sre22
asked on
Background images
I currently have my site load a background image using this code:
<style type="text/css">
<!--
body
{
background-position: top;
background-repeat: no-repeat;
background-image: url("../Images/Background. jpg"); /*default image background*/
}
-->
</style>
Is it possible to make this image stretch to the full size of users screen rather that it just being the normal pixel size?
<style type="text/css">
<!--
body
{
background-position: top;
background-repeat: no-repeat;
background-image: url("../Images/Background.
}
-->
</style>
Is it possible to make this image stretch to the full size of users screen rather that it just being the normal pixel size?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
how do the other options work that you were talking about (frames etc..)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks..
oups,
sorry to desagree, but you can use a JavaScript to strech it.
thanks to Massimo Foti !
<script language="JavaScript">
function makeIm() {
NS4=(document.layers);
IE4=(document.all);
scaleWidth = true;
scaleHeight = true;
imSRC = "images/yourImage.jpg";
if (NS4) {
origWidth = innerWidth;
origHeight = innerHeight;}
function reDo() {
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload();}
if (NS4) onresize = reDo;
if (IE4) onresize = reDoIE;
function reDoIE(){
imBG.width = document.body.clientWidth;
imBG.height = document.body.clientHeight ;}
winWid = (NS4) ? innerWidth : document.body.clientWidth;
winHgt = (NS4) ? innerHeight : document.body.clientHeight ;
imStr = "<div id=elBGim"
+ " style='position:absolute;l eft:0;top: 0;z-index: -1'>"
+ "<img name='imBG' border='0' src="+imSRC;
if (scaleWidth) imStr += " width="+winWid;
if (scaleHeight) imStr += " height="+winHgt;
imStr += "></div>";
document.write(imStr);}
makeIm();
</script>
sorry to desagree, but you can use a JavaScript to strech it.
thanks to Massimo Foti !
<script language="JavaScript">
function makeIm() {
NS4=(document.layers);
IE4=(document.all);
scaleWidth = true;
scaleHeight = true;
imSRC = "images/yourImage.jpg";
if (NS4) {
origWidth = innerWidth;
origHeight = innerHeight;}
function reDo() {
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload();}
if (NS4) onresize = reDo;
if (IE4) onresize = reDoIE;
function reDoIE(){
imBG.width = document.body.clientWidth;
imBG.height = document.body.clientHeight
winWid = (NS4) ? innerWidth : document.body.clientWidth;
winHgt = (NS4) ? innerHeight : document.body.clientHeight
imStr = "<div id=elBGim"
+ " style='position:absolute;l
+ "<img name='imBG' border='0' src="+imSRC;
if (scaleWidth) imStr += " width="+winWid;
if (scaleHeight) imStr += " height="+winHgt;
imStr += "></div>";
document.write(imStr);}
makeIm();
</script>
It's doing exactly what I want/expect it to, but I'm getting an "object required" runtime error on the line: "winWid = (NS4) ? innerWidth : document.body.clientWidth; " I asked a developer who's better with JavaScript than i am if he'd take a look. He's questioning the imBG object and thinks I'm missing an include. Do you know what might be going on?
This script doesnt seem to run in navigator 7.1. It works fin in IE6 though any suggestions??
ASKER