http://groupaware.mobi/iphone/longpage.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en" >
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0" />
<title>Fixed Top and Bottom</title>
<meta name="generator" content="BBEdit 8.6">
<style type="text/css" title="text/css">
<!--
html,body
{
margin:0px;
padding:0px;
font-family: Helvetica;
font-size: 20px;
text-align:center;
text-shadow: white 2px 2px;
line-height: 53px;
background-image:url("images/pat.png");
}
#pageBuckett
{
height:800px;
left:0px;
text-align:center;
width:100%;
}
#toolbar
{
background-image:url("images/bkg.png");
background-repeat:repeat;
position:absolute;
top:0px;
height:58px;
width:100%;
visibility:hidden;
}
#footer
{
background-image:url("images/bkgBot.png");
background-repeat:repeat;
position:absolute;
top:360px;
height:58px;
width:100%;
}
-->
</style>
<script type="text/javascript" language="javascript">
<!--
window.addEventListener("load", function() { setTimeout(loaded, 100) }, false);
window.addEventListener("scroll" , pageScrolled ,false );
function loaded() {
document.getElementById("toolbar").style.visibility = "visible";
window.scrollTo(0, 1); // pan to the bottom, hides the location bar
}
function pageScrolled()
{
// alert('scrollY : ' + window.pageYOffset +' scrollX : ' + window.pageXOffset);
document.getElementById("toolbar").style.top = window.pageYOffset + "px";
document.getElementById("footer").style.top = 480 + (window.pageYOffset - 58 - 20 - 44) + "px";
}
//-->
</script>
</head>
<body>
<div id="toolbar">Always On Top</div>
<div id="pageBuckett">
</div>
<div id="footer">Always On Bottom</div>
</body>
</html>