JQuery在HTML中实现图片随鼠标移动而移动


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>图片随鼠标移动</title>
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script type="text/javascript">        
$(function () {            
            $(document).mousemove(function (e) {
                $("#divMouse").css("left", e.pageX).css("top",e.pageY);

            });
      });      
    </script>
</head>
<body>
<div style=" width:200px; float:left;"><marquee>文字自右往左移动</marquee></div>  
   <div id="divMouse" style="width:100px; height:100px; position:absolute">   
  <marquee>   
       <div style=" float:left; width:50px; height:100px;">   
          <img src="images/*.jpg" style="width:50px; height:50px;" alt="" /></div>   
      <div style=" float:left; width:50px; height:100px;">     
          <img src="images/*.jpg" style="width:50px; height:50px;" alt="" /></div>   
</marquee>
</div>
</body>
</html>

posted @ 2012-03-19 20:19  violety  阅读(2359)  评论(0编辑  收藏  举报