两个div滚动条同步简单实现

横向滚动条同步:

<div id="div1" style="width:500px; overflow:scroll;"  οnscrοll="document.getElementById('div2').scrollLeft = this.scrollLeft;">

<div style="width:800px; height:50px;"></div>

</div>


<div id="div2" style="width:500px; overflow:scroll;"  οnscrοll="document.getElementById('div1').scrollLeft = this.scrollLeft;">

<div style="width:800px; height:50px;"></div>

</div>


竖向滚动条同步:

<div id="div1" style="width:500px; overflow:scroll;"  οnscrοll="document.getElementById('div2').scrollTop = this.scrollTop;">

<div style="width:800px; height:50px;"></div>

</div>


<div id="div2" style="width:500px; overflow:scroll;"  οnscrοll="document.getElementById('div1').scrollTop = this.scrollTop;">

<div style="width:800px; height:50px;"></div>

</div>