<style type="text/css">
    div{
        overflow-x:scroll;
        width:10%;
        height:10%;
        border:1px blue solid;
        position:relative;
    }
</style>
    <body>
<div >
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</div>
<div >
    bbbbbbbbbbbbbbbbbbb
</div>
</body>

<script>
        var div1 = document.getElementById("d1");
        var div2 = document.getElementById("d2");
        function a(){
            div2.onscroll = null;
            div2.scrollLeft = this.scrollLeft;
            div2.onscroll = b;
       }
       function b(){
            div1.onscroll = null;
            div1.scrollLeft = this.scrollLeft;
            div1.onscroll = a;
       }

       div1.onscroll = a;
       div2.onscroll = b;
    </script>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-31
  • 2022-12-23
  • 2021-11-23
  • 2021-07-20
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案