<!DOCTYPE html>
<html>
<head>
<style>
div{
display: block;
border: 1px solid red;
width: 100px;
height: 100px;
margin: 20px;
transition: 1s;
}
div:active, div.active{
transform: scale(1.2);
}
</style>
</head>
<body>
<div>тест</div>
<script>
var div = document.querySelector('div');
window.onkeydown=function(e){
if(e.keyCode==13) div.classList.add('active');
};
window.onkeyup=function(e){
if(e.keyCode==13) div.classList.remove('active');
};
</script>
</body>
</html>
может пример поможет