直接上代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body >
<img id="win" style='position:relative;top: 4px; left: 4px;' src="pg05@3x.png">
<button οnclick="zd()">振动</button>
<script src="jquery.js"></script>//自己加入
<script>
function zd(){
var a=['top','left'],b=0;
var u=setInterval(function(){
console.log(1);
$('#win').css(a[b%2],(b++)%4<2?0:4);
if(b>25){clearInterval(u);b=0}
},32);
}
</script>
</body>
</html>