I have an onclick event on every cell which contains an image.
After clicking on the cell, the image scales up an rotates by some angle specified.
I want the image to fade out and I want the description of the anime which is text to appear on the image. If I click again the same cell the text should fade out and the cell must return back as it was in the first place.
(I will accept it even if it can be done through a button event, but the button should be in the same cell. PLEASE TRY TO SOLVE THIS USING JAVASCRIPT WITHOUT USING ANY LIBRARIES OR FRAMEWORKS IF U CAN.)
<!--BODY OF THE HTML PAGE-->
<body>
<div class="c1" onclick="f(this)">
<img src="https://picsum.photos/200">
</div>
</body>
<!--CSS AND SCRIPT OF THE HTML PAGE-->
<style type="text/css">
.c1
{
background-color: blue;
width: 200px;
height: 200px;
position: absolute;
left:40%;
top: 30%;
transform: rotateZ(-45deg);
}
</style>
<script type="text/javascript">
timesclicked = 0;
function f(obj) {
timesclicked+=1;
if(timesclicked%2!=0)
{
obj.style.transform = 'scale(2) rotateZ(-90deg) ';
obj.style.transition = 'all 1s 0.3s';
}
else
{
obj.style.transform = 'scale(1) rotateZ(-45deg)';
obj.style.transition = 'all 1s 0.3s';
}
}
</script>