问一下使用jQuery如何让一张图片生成在随机位置,并往随机位置移动,一直循环 在移动时,鼠标点击图片便移动到另一位置。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!doctype html><html lang="en"><head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <title> 页面名称 </title></head><body><script type="text/javascript" src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script><img id="img" src="1.png" width="100" height="100" border="0" style="position: absolute;"><script type="text/javascript">var img = $("#img");function move() { img.stop(true).animate({ left: Math.floor(Math.random()*($(document).width()-img.width())), top: Math.floor(Math.random()*($(document).height()-img.height())) }, 3000, move);}img.click(function(event){ move();});move();</script></body></html> ext中this.getrow()问题 JS如何获取TR的ID? 最近做个IC消费卡的项目,客户端怎么读写IC卡呢? 弹出div总是在点击 求一js组件 一个多frame的js问题! 调用js文件中的函数修改innerHtml 层高度适应页面高度 文件选择窗口中列出*.csv ,用户只能选择*.csv 文件 如何读取当前窗口的大小(像素)? 关于Three.js中Prim算法可视化的实现 如何使用jQuery实现图片慢速移动到鼠标单击后的位置,并且双击图片变大,3秒后回到原始大小
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title> 页面名称 </title>
</head>
<body>
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<img id="img" src="1.png" width="100" height="100" border="0" style="position: absolute;">
<script type="text/javascript">
var img = $("#img");
function move() {
img.stop(true).animate({
left: Math.floor(Math.random()*($(document).width()-img.width())),
top: Math.floor(Math.random()*($(document).height()-img.height()))
}, 3000, move);
}
img.click(function(event){
move();
});
move();
</script>
</body>
</html>