Click to See Complete Forum and Search --> : Img size
SniperX
06-02-2003, 06:46 AM
Hi - how do I make an image fit into the full width of the frame, while the frame is different sizes depending on resolution etc...
Or should i go to the js section with this question???
Regards
Matty
Khalid Ali
06-02-2003, 07:34 AM
You preload the image first.
Then get the window size..
now you re-size the image according to the window size
image.width = W;
image.height = H;
SniperX
06-02-2003, 07:37 AM
image.width = frame.availWeight;
image.height = frame.availHeight;
Type of thing or what?
Could you perhaps post a sample code listing.
Regards mw
Khalid Ali
06-02-2003, 07:47 AM
yeah something like that..only you will have to find out the internal size of that frames window...
SniperX
06-02-2003, 07:50 AM
but i am feeling a bit stupid lately - i have forgotten all basics -etc...
That'll show me to go on holiday for 3 weeks...
Could you explain to me how i would get the internal frame size. PLEASE
Thanks...
Khalid Ali
06-02-2003, 08:00 AM
I guess in that case...the code below should do it.
<script type="text/javascript">
<!--
function Process(){
if(document.images){
var img = new Image();
img.src = "someSrc.gif";
var imageSizes = getPosition();
img.width = parseInt(imageSizes[0]);
img.height = parseInt(imageSizes[1]);
}
}
function getPosition(){
var w =0; h = 0;
if(document.all){
w = (document.body)? parseInt(document.body.clientWidth) : parseInt(document.documentElement.clientWidth);
h = (document.body)? parseInt(document.body.clientHeight) : parseInt(document.documentElement.clientHeight);
return new Array(w,h);
}else{
w = parseInt(window.innerWidth);
h = parseInt(window.innerHeight);
return new Array(w,h);
}
}
//-->
</script>
</head>
<body class="body" onload="Process();">
Make sure you call process when you need it,I just call it onload to make point...
FYI...the above is almost an absolute window internal size findong code.njoy...:D
SniperX
06-02-2003, 08:04 AM
That works
GRAND!!!
:D
Thanks alot :D :D :D :D :D :D
Regards
MW
Khalid Ali
06-02-2003, 08:10 AM
:p
You are most welcome....