`
kenshinlk
  • 浏览: 116726 次
  • 性别: Icon_minigender_1
  • 来自: 广东.佛山.南海
社区版块
存档分类
最新评论

鼠标控制DiV层滚动

阅读更多
<html>
        <body  onscroll="move()">
<div style="position:absolute;top:30px;left:0px; width:300; height:300" id=a>
  <table width="50" height="100%" bgcolor="blue">
          <tr width="100%" height="100%"><td width="100%" height="100%">ddddddd</td></tr>
  </table>
</div>
  <table width="1000%" height="1000" >
          <tr width="100%" height="100%"><td width="100%" height="100%">ddddddd</td></tr>
  </table>
        <script>
                  function move() {
                      var y = document.body.scrollTop;
                      document.getElementById("a").style.top = eval(y+30)+"px";
                      var x = document.body.scrollLeft;
                      document.getElementById("a").style.left = eval(x)+"px";
                  }
        </script>
</body>
</html>

鼠标滚动,层跟着滚动
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics