跟着鼠标飞的图片

Posted jiumen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了跟着鼠标飞的图片相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    body 
      height: 1000px;
    
    #ts 
      position: absolute;
    
  </style>
</head>
<body>
  <img src="images/tianshi.gif" id="ts" alt="">
  <script>
    var ts = document.getElementById(ts);
    document.onmousemove = function (e)  
      e = e || window.event;
      // ts.style.left = e.clientX - 10 + ‘px‘;
      // ts.style.top = e.clientY - 10 + ‘px‘;

      ts.style.left = e.pageX - 10 + px;
      ts.style.top = e.pageY - 10 + px;
    
  </script>
</body>
</html>

 

以上是关于跟着鼠标飞的图片的主要内容,如果未能解决你的问题,请参考以下文章