In my HTML, I have one parent div and have 25 div's inside it.
<div class="container>
<div class="faces"></div>
<div class="faces"></div>
<div class="faces"></div>
.
.
.
.
.
</div>
I'm using CSS grids
.container {
display: grid;
grid-template-columns: repeat(5, auto);
margin: 2% auto;
width: 750px;
grid-gap: 1px;
}
.container > div {
overflow: hidden;
height: 150px;
border: 1px solid;
}
.faces img {
height: 150px;
}
This gives me 5 div in each row.
Now when I click on any div I want it to expand
$('.faces').click(function() {
$(this).css('grid-column','span 3');
$(this).css('grid-row','span 2');
$(this).css('height','auto');
}):
This JS does work. But i just want only the clicked element to have such css property. When another div is clicked the previous should take back its position.
How do I do it?