To set the divs’ position horizontally fixed but not vertically, use the following code :
HTML
<div id="container">
<div id="manu"></div>
</div>
CSS
<style type="text/css">
#container {
position:relative;
width:700px;
height:1000px;
top:50px;
left:50px;
background-color:yellow;
}
#manu{
position:fixed;
width:100px;
height:100px;
background-color:blue;
margin-top:20px;
margin-left:400px;
}
</style>
Jquery
<script type="text/javascript">
$(window).scroll(function(event) {
$("#manu").css("margin-left", 400-$(document).scrollLeft());
});
</script>
To see demo please click the link below :