https://jsfiddle.net/fy7dzfdL/1/
您好,我创建了jsfiddle,让您更好地了解我当前的场景。我正在制作固定的div,它必须滚动与页面滚动,这是完美的固定位置,但在我的html文件中,当你滚动到页脚或当你点击隐藏按钮时,你会看到滚动div与页脚混合,这是如何在底部处理它的问题。
下面是JS css和html
$("#hide_show").click(function(){
$("#toggle").toggle();
});.fixed_div {
background-color: gray;
border: 1px solid red;
float: right;
left: 75%;
position: fixed;
top: 9%;
width: 20%;
height:320px;
px;
}
.left_content{
background-color: gray;
border: 1px solid red;
width: 59%;
height: 150px;
}
.header{
background-color: gray;
border: 1px solid red;
height: 100x;
text-align:center;
margin-bottom:10px;
}
.footer{
background-color: gray;
border: 1px solid red;
height: 100px;
text-align:center;
margin-top:10px;
}<div class="header">
i am header
</div>
<div class="left_content">
i am static content
</div>
<div class="left_content">
i am static content
<input type="button" value="hide" id="hide_show">
</div>
<div class="left_content" id="toggle">
i am static content
</div>
<div class="fixed_div">
helloo i have to scroll across all the page
</div>
<div class="footer">
i am footer
</div>
发布于 2016-03-19 03:33:41

将静态内容包装在div中。然后将div的CSS min-height设置为固定div的高度。
https://stackoverflow.com/questions/36083420
复制相似问题