首页 > 代码库 > JQ图片跟着鼠标走

JQ图片跟着鼠标走

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title></title>

<script src="http://www.mamicode.com/Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type ="text/javascript" >
$(function() {
$(document).mouseover(function(e) {
// $("#fly").css("left", e.pageX).css("top", e.pageY);
$("#fly").css("left", e.pageX);
$("#fly").css("top", e.pageY);
});
});
</script>
</head>
<body>
<div id ="fly" style =" position :absolute "><img src ="http://www.mamicode.com/image/00.jpg" width ="30px" height="30px" alt ="" /></div>
</body>
</html>