简体   繁体   English

如何在滚动页面和处理高度时使div滚动

[英]how to make a div scroll while page scrolling and dealing with height

https://jsfiddle.net/fy7dzfdL/1/ https://jsfiddle.net/fy7dzfdL/1/

Hi i have created jsfiddle to make you aware better understanding of my current scenario . 嗨,我创建了jsfiddle以使您更好地了解当前的情况。 i am making fixed div that has to scroll with page scroll that is working perfectly by position fixed but in my html document when you scroll at the end towards footer or when u click on hide button you will see scrolling div mixing with footer that is the issue how to handle it in the bottom. 我正在制作固定的div,它必须与固定位置的完美滚动的页面滚动一起滚动,但是在我的html文档中,当您向页脚末端滚动时或当您单击隐藏按钮时,您将看到滚动的div与页脚混合在底部发布如何处理它。

here is JS css and html below 这是下面的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> 

在此处输入图片说明

Wrap the static content content in a div. 将静态内容内容包装在div中。 Then set the CSS min-height of the div equal the the height of the fixed div. 然后将div的CSS min-height设置为等于固定div的高度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM