I want to do animation of opening two (top and bottom) 'shutters', behind which I want to show some data (eg. number).
I am using z-index
, because I want the number behind this curtain (opening shutters) to be there before curtain is open.
Animation need to be that upper stripe will shrink to the top edge and lower striper will shrink to the bottom edge. Shrink should be visible as making height of each strip lower - so from original height of 13px to 0px. At the same time upper's stripe CSS top
attribute should be +=1px and lower's stripe top
should be -=1px, to mimic that they are opening.
For now i have problem with making each stripe height
from original value to 0px (only one of them is 'opening'). And i don't know how to change their top
attributes at the same time.
When in middle of animation time, it should like below:
CSS and HTML
#wrapper {
width: 100px;
height: 30px;
border: 2px solid black;
position: relative;
top: 50px;
z-index: 2;
}
.stripe {
position: relative;
width: 98px;
height: 13px;
background: green;
z-index: 1;
border: 1px solid red;
transition: height 500ms ease-in-out;
}
.stripe:hover {
height: 0;
}
#money {
position: relative;
top: -25px;
width: 90%;
display: block;
margin: 0 auto;
z-index: 0;
text-align: center;
}
<div id="wrapper">
<div class="stripe"></div>
<div class="stripe"></div>
<input type="text" id="money" value="1200">
</div>