CodePen

HTML

            
              <img src="http://lorempixel.com/200/200">
            
          
!

CSS

            
              @import "compass/css3";

img { 
  display: block; 
  margin: 20px auto;
  cursor: pointer;
  
  &:active {
    animation: vibrate 0.1s infinite;
  }
}

@keyframes vibrate {
  50% { transform: rotate(1deg) translateX(1px); }
  100% { transform: rotate(-1deg) translateX(-1px); }
}
            
          
!

JavaScript

            
              
            
          
!
999px
Loading ..................