Написал скрипт, который при наведении на блок расширяет его, а другие уменьшает, но при расширении текст в блоках начинает "дрожать", как это можно исправить?
HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/main.css">
<title>Rogaga</title>
</head>
<body>
<div class="container">
<div class="block1">
<h1>HTML</h1>
</div>
<div class="block2">
<h1>CSS</h1>
</div>
<div class="block3">
<h1>JS</h1>
</div>
</div>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>
CSS
.container{
width:70vw;
margin: 200px auto;
display:flex;
justify-content: center;
align-items: center;
min-height: 200px;
}
.block1, .block2, .block3{
width: 300px;
height: 150px;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
transition-duration: 1s;
}
.block1{
background-color: plum;
}
.block2{
background-color: salmon;
margin-left: 100px;
margin-right: 100px;
}
.block3{
background-color: aquamarine;
}
JS
$(".block1").hover (function () {
$(".block1").css("width","350px").css("height","200px");
$(".block2").css("width","250px").css("height","100px");
$(".block3").css("width","250px").css("height","100px");
}, function () {
$(".block1").css("width","300px").css("height","150px");
$(".block2").css("width","300px").css("height","150px");
$(".block3").css("width","300px").css("height","150px")
});
$(".block2").hover (function () {
$(".block2").css("width","350px").css("height","200px");
$(".block1").css("width","250px").css("height","100px");
$(".block3").css("width","250px").css("height","100px");
}, function () {
$(".block2").css("width","300px").css("height","150px");
$(".block1").css("width","300px").css("height","150px");
$(".block3").css("width","300px").css("height","150px")
});
$(".block3").hover (function () {
$(".block3").css("width","350px").css("height","200px");
$(".block2").css("width","250px").css("height","100px");
$(".block1").css("width","250px").css("height","100px");
}, function () {
$(".block3").css("width","300px").css("height","150px");
$(".block2").css("width","300px").css("height","150px");
$(".block1").css("width","300px").css("height","150px")
});