Try this:
Code:
window.onscroll = function()
{
if( window.XMLHttpRequest )
{
var stop = parseInt(document.documentElement.scrollTop);
if ( isNaN(stop) || stop == 0 )
{
stop = parseInt(document.body.scrollTop);
}
if ( ! isNaN(stop) && stop != 0 )
{
document.getElementById('fire').style.position = 'fixed';
document.getElementById('fire').style.top = (- stop ) + "px;
}
}
}
</script>
Whether or not document.documentElement exists depends on the type of page you are using (HTML, XHTML transitional, XHTML strict) and seems to vary by browser. My hack is to try document.documentElement first and, if it doesn't work, then fall back to document.body.
And that replace() should have removed the "px" from scrollTop if it came back as "135px" (for example), but parseInt will do the same thing, so K.I.S.S.