J
José Joye
Hello (it's me again ;-) )
I'm still fighting with positioning a DIV element at the bottom of my
window.
I'm trying to be cross-browser compatible (at least with their newest
versions).
With my current script this works (more or less) with IE, Netscape and
Mozilla(Linux). However, it does not work with Opera.
With Opera, if I have the following behaviour:
- My DIV element is truncated (in the height)
- if the Horizontal scrollbar is active. The page will scroll up even if
we reach the end of the document.
Any hints?
José
<html>
<head>
<script>
<!--
function f_resize_bottom()
{
// Get the height of the visible portion of the screen
d=document;
var winHeight;
var scrollTop = 0;
if (typeof window.innerWidth!='undefined') {
winHeight = window.innerHeight;
scrollTop = d.body.scrollTop
} else {
if (d.documentElement &&
typeof d.documentElement.clientWidth!='undefined' &&
d.documentElement.clientWidth!=0) {
winHeight = d.documentElement.clientHeight
scrollTop = d.body.scrollTop
} else {
if (d.body &&
typeof d.body.clientWidth!='undefined') {
winHeight = d.body.clientHeight
scrollTop = d.body.scrollTop
}
}
}
// adjust position to place the banner at bottom of screen
var element;
if (document.getElementById) {
element = document.getElementById('layer_bottom');
if (element && element.style) {
var topPos = parseInt(scrollTop) + parseInt(winHeight) -
parseInt(element.style.height);
element.style.top = topPos;
}
}
}
//-->
</script >
</head>
<body onresize=f_resize_bottom() onscroll=f_resize_bottom()
onload=f_resize_bottom()>
<div style="overflow:hidden; position:absolute; width:100%; height: 43px;
z-index: 1000; left: 0px; top: 200px" id="layer_bottom" name="layer_bottom">
<table border="0" cellpadding="0" cellspacing="0" style="margin-top: 8px"
background="../images/fond_bandeau_bleu.gif">
<tr height="35px">
<td width="150" nowrap>
<p class="CRight">© 2004 All rights reserved<br>
My Company</td>
<td width="620"><img border="0" src="../images/bandeau_bleu.gif"
height="35" width="620"></td>
<td width="100%"></td>
</tr>
</table>
</div>
<p>hello</p>
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
<p>0</p>
<p>1</p>
<p>2</p>
<p>3</p>
<p>4
</p>
</body>
I'm still fighting with positioning a DIV element at the bottom of my
window.
I'm trying to be cross-browser compatible (at least with their newest
versions).
With my current script this works (more or less) with IE, Netscape and
Mozilla(Linux). However, it does not work with Opera.
With Opera, if I have the following behaviour:
- My DIV element is truncated (in the height)
- if the Horizontal scrollbar is active. The page will scroll up even if
we reach the end of the document.
Any hints?
José
<html>
<head>
<script>
<!--
function f_resize_bottom()
{
// Get the height of the visible portion of the screen
d=document;
var winHeight;
var scrollTop = 0;
if (typeof window.innerWidth!='undefined') {
winHeight = window.innerHeight;
scrollTop = d.body.scrollTop
} else {
if (d.documentElement &&
typeof d.documentElement.clientWidth!='undefined' &&
d.documentElement.clientWidth!=0) {
winHeight = d.documentElement.clientHeight
scrollTop = d.body.scrollTop
} else {
if (d.body &&
typeof d.body.clientWidth!='undefined') {
winHeight = d.body.clientHeight
scrollTop = d.body.scrollTop
}
}
}
// adjust position to place the banner at bottom of screen
var element;
if (document.getElementById) {
element = document.getElementById('layer_bottom');
if (element && element.style) {
var topPos = parseInt(scrollTop) + parseInt(winHeight) -
parseInt(element.style.height);
element.style.top = topPos;
}
}
}
//-->
</script >
</head>
<body onresize=f_resize_bottom() onscroll=f_resize_bottom()
onload=f_resize_bottom()>
<div style="overflow:hidden; position:absolute; width:100%; height: 43px;
z-index: 1000; left: 0px; top: 200px" id="layer_bottom" name="layer_bottom">
<table border="0" cellpadding="0" cellspacing="0" style="margin-top: 8px"
background="../images/fond_bandeau_bleu.gif">
<tr height="35px">
<td width="150" nowrap>
<p class="CRight">© 2004 All rights reserved<br>
My Company</td>
<td width="620"><img border="0" src="../images/bandeau_bleu.gif"
height="35" width="620"></td>
<td width="100%"></td>
</tr>
</table>
</div>
<p>hello</p>
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
<p>0</p>
<p>1</p>
<p>2</p>
<p>3</p>
<p>4
</p>
</body>