/** * Animation on hover (right way) */ div { width: 9em; padding: .6em 1em; margin: 2em auto; background: yellowgreen; animation: spin 1s linear infinite; animation-play-state: paused; } @keyframes spin { to { transform: rotate(1turn); } } div:hover { animation-play-state: running; }
<div ontouchstart="">Hover over me and watch me spin!</div>
// alert('Hello world!');