私は2時間以上この問題に苦しんでいます、それがより大きなdivの中にある間にdivを修正する方法はありますか?スクロールするときは、右側の部分をスクロールしないようにします。
だから私の質問は、jqueryなしでこれを行う方法はありますか?
ありがとう
私は2時間以上この問題に苦しんでいます、それがより大きなdivの中にある間にdivを修正する方法はありますか?スクロールするときは、右側の部分をスクロールしないようにします。
だから私の質問は、jqueryなしでこれを行う方法はありますか?
ありがとう
内側のdivlyを配置する必要がありますabsolute
。
.outerDiv {
position: relative;
/* give it some height */
}
.contentDiv {
height: 100%;
overflow: auto;
}
.innerDiv {
position: absolute;
right: 0;
left: 50%;
top: 0; bottom: 0;
}
これがフィドルです:http://jsfiddle.net/wSxss/
必要に応じて位置決め値を調整してください。
HTML
<div class="wrapper">
<div class="scroller></div>
<div class="fixed"></div>
</div>
CSS(重要な部分の例)
.wrapper {
position: relative;
height: 40px;
overflow: hidden;
}
.scroller {
padding-right: 200px;
height: 100%;
overflow: auto;
}
.fixed {
position: absolute;
top: 0;
right: 15px;
bottom: 0;
width: 160px; /* .scroller padding minus the right offset to accomodate scroll bar and minus any real separation between it and the scroller */
}