A ceiling bar or something.

Source: Internet
Author: User

<! 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.