<! DOCTYPE html>
<style>
*{margin:0;padding:0;list-style:none;}
body{
width:1180px;
margin:0 Auto;
}
. head{
width:100%;
height:60px;
background:red;
}
. main{
margin:30px 0;
height:100%;
Overflow:hidden;
}
. foot{
width:100%;
height:40px;
Background: #000;
Clear:both;
}
. left{
Float:left;
width:210px;
height:1300px;
border:1px solid red;
Background:green;
}
. right{
Float:right;
width:930px;
height:900px;
border:1px solid red;
Background: #ccc;
}
</style>
<!--
<script>
(function () {
Window.onresize=window.onscroll=window.onload=function () {
var Odiv=document.getelementbyid (' Form-wrap ');
var Scrolltop=document.documentelement.scrolltop | | Document.body.scrollTop;
var clientheight=document.documentelement.clientheight;
var t=document.body.scrollheight;
var bodyh= scrolltop+clientheight;
if (Math.Abs (BODYH-T) < 5) {
Odiv.style.bottom= ' 40px ';
}else{
odiv.style.bottom= ' 0px ';
}
};
})();
</script>
-
<script>
Window.onload= window.onscroll=function () {
var oleft = document.getElementById (' left ');
var oright = document.getElementById (' right ');
var scrolltop = Document.documentElement.scrollTop | | Document.body.scrollTop;
When the left height is the highest of right
if (Oleft.offsetheight >oright.offsetheight) {
OLeft.style.height =getstyle (oright, ' height ') + ' px ';
}
When the left scrolltop is 0,fixed
if (ScrollTop > Oleft.offsettop) {
oLeft.style.position = ' fixed ';
OLeft.style.top = ' 0 ';
if (oleft.offsetheight<oright.offsetheight) {
OLeft.style.height =getstyle (oright, ' height ') + ' px ';
}else{
OLeft.style.height =document.documentelement.clientheight-70 + ' px ';
}
}else{
OLeft.style.position = ";
}
function GetStyle (obj,name) {
Return Obj.currentstyle? Obj.currentstyle[name]: getComputedStyle (obj, false) [name];
}
}
</script>
<body>
<div class= "Head" ></div>
<div class= "Main" >
<div class= "left" id= "left" >
<ul>
<li> Menu 1</li>
<li> Menu 2</li>
<li> Menu 3</li>
<li> Menu 4</li>
<li> Menu 5</li>
</ul>
</div>
<div class= "Right" id= "OK" > here is the content </div>
</div>
<div class= "Foot" ></div>
</body>
A ceiling bar or something.