<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">   <head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title>两个div同时滚动</title>    <meta name="author" content="Administrator" />            <style type="text/css">     div{         overflow-x:scroll;         width:10%;         height:10%;         border:1px blue solid;         position:relative;     } </style>    <!-- Date: 2012-05-11 -->   </head>   <body>

 

<div > aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa </div>

<div > bbbbbbbbbbbbbbbbbbb </div>

 

<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>   </body>

</html>两个div同时滚动

相关文章:

  • 2022-02-09
  • 2022-12-23
  • 2021-12-26
  • 2022-01-29
  • 2021-06-13
  • 2022-12-23
  • 2021-11-17
  • 2021-12-29
猜你喜欢
  • 2021-10-31
  • 2021-08-01
  • 2021-11-17
  • 2021-11-23
  • 2022-02-21
  • 2021-07-20
  • 2021-12-25
相关资源
相似解决方案