I want shrink poster width size, because i want to create illusion of depth before new element is shown above.
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body{
margin: 0 0 10% 0;
padding: 0;
background-color: #191919;
}
.movie{
position: relative;
margin: 10% auto 0 auto;
width: 80%;
border-radius: 10px;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.66);
transition: .5s linear;
}
.poster{
display: block;
width: 100%;
border-radius: 10px;
}
</style>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$(document).ready(function(){
$(".movie").click(function(){
$(".movie").animate({width: "70%"});
});
})
</script>
</head>
<body>
<div class="main_page">
<div class="movie" id="602147">
<img class="poster" src="https://image.tmdb.org/t/p/w780/l13mt3oHErSkkqJbN1bjzgtK0Vq.jpg"/>
</div>
<div class="movie" id="576156">
<img class="poster" src="https://image.tmdb.org/t/p/w780/5jdLnvALCpK1NkeQU1z4YvOe2dZ.jpg"/>
</div>
<div class="movie" id="385103">
<img class="poster" src="https://image.tmdb.org/t/p/w780/zG2l9Svw4PTldWJAzC171Y3d6G8.jpg"/>
</div>
<div class="movie" id="686245">
<img class="poster" src="https://image.tmdb.org/t/p/w780/niyXFhGIk4W2WTcX2Eod8vx2Mfe.jpg"/>
</div>
<div class="movie" id="582596">
<img class="poster" src="https://image.tmdb.org/t/p/w780/A2YlIrzypvhS3vTFMcDkG3xLvac.jpg"/>
</div>
<div class="movie" id="618344">
<img class="poster" src="https://image.tmdb.org/t/p/w780/c01Y4suApJ1Wic2xLmaq1QYcfoZ.jpg"/>
</div>
<div class="movie" id="536517">
<img class="poster" src="https://image.tmdb.org/t/p/w780/6btICrn3RsbtxZCthtb0MsR9lcq.jpg"/>
</div>
</div>
</body>
</html>
Here is my demo on jsfiddle
When i click on 1st poster i get nice image shrink. Problem is when i click on posters that are far from the top of the page, all posters then are moved to the top on click and shrink animation is not the same like with first poster. How can i achieve shrink animation of first poster on all posters?