Edit in JSFiddle

<button id='spring-btn'>
  Spring it!
</button>
<div class="demo">
</div>
.spring {
  animation: spring 2s linear 3s alternate-reverse 4 both;
}

@keyframes spring {
  0% {
    transform: scaleY(0.2);
    background-color: red;
  }
  40% {
    transform: scaleY(0.3);
  }
  60% {
    transform scaleY(0.5);
  }
  100% {
    transform: scaleY(1.2);
    background-color: green;
  }
}

.demo {
  height: 100px;
  background-color: blue;
}

#spring-btn {
  height: 50px;
  font-size: 20px;
  margin: 20px;
}
$(function() {
  $demoDiv = $('.demo');
  $('#spring-btn').click(function() {
		if ($demoDiv.hasClass('spring')) return;
		$demoDiv.addClass('spring');
    setTimeout(function() {
     $demoDiv.removeClass('spring');
    }, 11000);
  });
});