Home >Web Front-end >HTML Tutorial >Does not move with the scroll bar_html/css_WEB-ITnose

Does not move with the scroll bar_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:14:271275browse

Displays two parts of data,
The upper part does not move with the scroll bar, that is, it is always displayed
The lower part is normal

http://www.cnblogs.com/cracker/archive /2011/07/04/css_fixed.html

I don’t understand this article. Please give me some advice


Reply to the discussion (solution)

4ec11beb6c39d0703d1751d203c17053
function init(){
var p=document.getElementsByTagName("div")[0];
var div=document.getElementById(" test");
var x=document.body.scrollTop||document.documentElement.scrollTop;
div.innerHTML=x;
p.style.top=parseInt(x) "px";
}
window.onscroll=init;
Try this

Can it be solved with css4ec11beb6c39d0703d1751d203c17053
function init(){
var p=document.getElementsByTagName("div")[0];
var div=document.getElementById("test");
var x=document.body.scrollTop||document.documentElement.sc ……

css position :fixed

can be completely solved with css. For browsers IE6 and above, use position:fixed; for IE6, you can use position:absolute;top:expression(eval('document .documentElementScrollTop'))

The scroll bar is not disabled. It just makes the upper area immobile.

Please help me.


Set the lower area to scroll. Bar

Please provide the code to set the scroll bar in the following area

<style>#div0,#div1,#div2{  margin:0px;  float:left;  width:300px;  }#div0{   height:200px;}#div1{   height:20px;}#div2{    overflow:auto;    height:180px;}</style><div id="div0">   <div id="div1">   </div>   <div id="div2">   </div><div>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn