fixed是相对于body的,给个DEMO你参考
<style>
#fixed{position:fixed;left:0px;top:0px;border:solid 1px #000;width:100%;background:#fff}
</style>
<div id="fixed">fixed定位容器</div>
<div style="width:2000px;height:2000px">内容</div>
<script>
window.onscroll=function(){
var sl=-Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
document.getElementById('fixed').style.left=sl+'px';
}
</script>
aaaa