坐标随鼠标移动 jquery简易版

<html>

<span style="position:absolute" id="xy_test"></span>

</html>

<script>

 $(function(){

  $(document).mousemove(function(e){
  $('#xy_test').text(e.clientX+","+e.clientY);
  $('#xy_test').css('left',e.clientX+15+document.body.scrollleft - document.body.clientleft);
  $('#xy_test').css('top',e.clientY+15+document.body.scrollTop - document.body.clientTop);
  })

})

</script>

  模版世界:http://www.templatesy.com

posted @ 2013-07-13 10:12  xh_a1216  阅读(350)  评论(1编辑  收藏  举报