Richard Cornford said:
The CSS units problem is not at all difficult to handle:-
<URL:
http://jibberingg.com/faq/faq_notes/misc.html#mtCSSUn >
OK, but another pitfall is that Mozilla doesn't update
document.documentElement.scrollTop, so it's just as well that
window.pageYOffset is still available as it must be used instead.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 strict//EN">
<HTML>
<HEAD>
<style>
..slider{position:absolute;left:30px; top:20px; border-style:ridge;
border-color:#0000ff; border-width:4px;
background-color:#000080; color:#ffffff; padding:10px; font-weight:bold}
</style>
</HEAD>
<BODY>
<DIV class=slider ID=slide>
Scroll the page & I will hide until the page stops.
</DIV>
<SCRIPT>
// (C)S Chalmers
function vPosData()
{
this.index=0;
this.v=0;
if( typeof(window.pageYOffset)!='undefined' ) //must test first
this.index=3;
else
if( typeof(document.body.scrollTop)!='undefined' )
this.index=( document.compatMode &&
document.compatMode.indexOf("CSS")==0 ) ? 1 : 2;
this.getVPos();
}
vPosData.prototype.getVPos=function()
{
switch(this.index)
{
case 3: this.v=window.pageYOffset; break;
case 2: this.v=document.body.scrollTop; break;
case 1: this.v=document.documentElement.scrollTop; break;
case 0: this.v=0;
}
return this.v;
}
var stopWait=null, dr=getDivRef('slide'), scrollPeriod=null, vp=new
vPosData(), oldVPos=vp.v;
function moveDiv(dRef)
{
if(dRef)
{
dRef.visibility='hidden';
clearTimeout(stopWait);
stopWait=setTimeout("getDivRef('slide').visibility='visible'",800);
dRef.top=20+vp.getVPos()+(typeof(dRef.top)=='string'?'px':0);
}
}
function getDivRef(divId)
{
return document.getElementById
?
document.getElementById(divId).style
:document.layers
?
document.layers[divId]
:document.all
?
document.all(divId).style
:null;
}
scrollPeriod=setInterval("if(oldVPos!=vp.getVPos()){oldVPos=vp.getVPos();mov
eDiv(dr)}",200); //NN4 fix
window.onscroll=function()
{
if(scrollPeriod!=null)
{
clearInterval(scrollPeriod);
scrollPeriod=null;
}
moveDiv(dr);
};
//// Line generator only - REMOVE ////
for(var i=0, repeatCount=100/document.location.href.length;
i<repeatCount;i++)
for(var j=0; j<document.location.href.length;j++)
document.write(document.location.href.charAt(j)+"<BR>");
///////////////////////////////////////
</SCRIPT>
</BODY>
</HTML>