簡體   English   中英

如何獲得固定的div滾動窗口其余部分?

[英]How do I get a fixed scrolling div to scroll with the rest of the window?

這是jfiddle http://jsfiddle.net/pq5ckkcg/4/ 無論鼠標在哪里,我基本上都需要整個窗口和div一起滾動。 我將如何完成?

<div id="bottomwrap">
<div id="element"></div>
<div id="element"></div>
<div id="element"></div>
</div>

#bottomwrap {
position:fixed;
top:45px;
right:0;
width:80%;
overflow-y:scroll;
bottom:0;
background-color:#666;
}
#element {
float:left;
width:200px;
height:300px;
background-color:#000;
margin:20px;
}

您的父div需要相對定位:

#bottomwrap {
    position:relative;
    margin-top:45px;
    float: right;
    width:80%;
    overflow-y:scroll;
    bottom:0;
    background-color:#666;
}

http://jsfiddle.net/pq5ckkcg/3/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM