当鼠标在图片上使图片向左旋转45渡 然后再向右旋转45度

当鼠标在图片上使图片向左旋转45度 然后再向右旋转45度当鼠标移到图片上使图片以图片顶部中心位置为中心向

当鼠标在图片上使图片向左旋转45度 然后再向右旋转45度
当鼠标移到图片上使图片  以图片顶部中心位置为中心
向左旋转45度 然后再向右旋转45度  实现摇晃效果?如何实现
[解决办法]
用css来实现,ie9以上支持


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

</head>
<body>
 <style>
.r{ 
 margin:150px;
    height:100px;
    width:100px;
 }

@-webkit-keyframes t-r { 
25% { -webkit-transform: rotate(-10deg); }
75% { -webkit-transform: rotate(10deg); } 
100% { -webkit-transform: rotate(0deg); } 
}

@-moz-keyframes t-r  { 
25% { -moz-transform: rotate(-10deg); }
75% { -moz-transform: rotate(10deg); } 
100% { -moz-transform: rotate(0deg); } 
}
@-ms-keyframes t-r { 
25% { transform: rotate(-10deg); }
75% { transform: rotate(10deg); } 
100% { transform: rotate(0deg); } 
}
 .r img:hover{
    border:1px solid #ccc;
  -webkit-animation-name: t-r ;  
-webkit-animation-duration: 0.3s;
 -webkit-animation-iteration-count: 1; 
-webkit-transition-timing-function: ease-in-out;

  -moz-animation-name:t-r ;  
-moz-animation-duration: 0.3s;
-moz-animation-iteration-count: 1; 
-moz-transition-timing-function: ease-in-out;
  animation-name:t-r;  
animation-duration: 0.3s;
animation-iteration-count: 1; 
transition-timing-function: ease-in-out;
 }
 .r img{
border:1px solid #ccc;
    height:100px;
    width:100px;
 }
 </style> 
 <div class="r" >
 <img  src="http://www.google.com.hk/images/srpr/logo4w.png"> 
 </div>
</body> 
</html>