<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>跟住鼠标移动的图片</title> <script src="js/jquery-1.4.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$(document).mousemove(function(e){
$("#fly").css("left",e.pageX).css("top",e.pageY);
})
.mousedown(function(e){
if(e.button == 1){
$(document).bind("mousemove");
}
});
});
</script>
</head>
<body>
<div id="fly" style="position:absolute"><img src="img/demo.gif"/></div>
</body>
</html>
当点击左键的时候将div固定在当前鼠标位置
用移除mousemove方法实现,但是无法实现,是什么问题?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货