Freezing A Div From Horizontal Scrolling But Letting It Scroll Vertically
I have an outer division(with fixed height and width) which contains two divisions placed vertically occupying equal widths and full height. I want them to scroll simultaneously in
Solution 1:
<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>
Post a Comment for "Freezing A Div From Horizontal Scrolling But Letting It Scroll Vertically"