首页 > Web开发 > 详细

图片随鼠标动(jQuery)

时间:2018-03-21 10:04:41      阅读:162      评论:0      收藏:0      [点我收藏+]

<!DOCTYPE html>
<html>
 <head>
  <meta charset="utf-8" />
  <title></title>
  <script src="js/jquery-1.12.3 (1).js"></script>
   <style type="text/css">
   .wap{
    height: 500px;
    width: 500px;
    background-color:aquamarine;
    position: relative;
   }
   img{
    position: absolute;
   }
  </style>
  
  <script type="text/javascript">
   $(function(){
    $(".wap").mousemove(function(e){
     $(".img").css({
      "top":e.offsetY,
      "left":e.offsetX
     })
    });
   });
  </script>
 
 </head>
 <body>
  <div class="wap">
   
  </div>
  <img class="img" height="30" width="30" src="img/untitled.png"/>
 </body>
</html>

图片随鼠标动(jQuery)

原文:https://www.cnblogs.com/index0629/p/8615189.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!