私は、同じ幅と全高を占める垂直に配置された2つの部門を含む外側の部門(高さと幅が固定されている)を持っています。それらを垂直方向に同時にスクロールしたいのですが、水平方向にスクロールするのは2番目だけです。そのため、基本的に最初の div は水平スクロールだけで固定されます。div 内では、SVG ベースのグラフィックスを使用したデータの視覚化に d3 を使用しています。
3007 次
1 に答える
2
<style>
div.Container{
height: 250px;
border: 2px solid #F00;
width: 600px;
padding: 3px;
overflow: auto;
/* POSITION */
position:fixed;
}
div.Const{
border: 2px solid #0F0;
width: 200px;
height: 400px;
float:left;
position:absolute;
}
div.Main{
border: 2px solid #00F;
width: 800px;
height: 200px;
margin-left: 220px;
top:0px;
float:left;
}
</style>
<body>
<div id="Container" class="Container">
<div id="Const" class="Const">
</div>
<div id="Main" class="Main">
</div>
</div>
</body>
<script>
$('#Container').scroll(function() {
$('#Const').css('left', $('#Container').scrollLeft());
});
</script>
于 2013-06-11T07:13:25.513 に答える