给你写了个Demo,你自己换成图片即可,但需要HTML5的支持。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"><html>
<head>
<style type="text/css">
div {
width: 150px
height: 10px
position: absolute
top: 100px
left: 100px
background-color: #4265ac
}
</style>
</head>
<body>
<div id="div" onclick="if(running){stop()}else{start()}"></div>
</body>
<script type="text/javascript">
var running = false
var interval = undefined
function start() {
var rotate = 0
interval = setInterval(function() {
div.style.transform = "rotate(" + (rotate += 20) + "deg)"
}, 50)
running = true
}
function stop() {
clearInterval(interval)
running = false
}
</script>
</html>