I have a textarea that I want to expand to full screen and animate some aspects of that transition. Here's the markup:
<div class="wrapper">
<textarea>This is a sample text</textarea>
<div class="full-screen-button">x</div>
</div>
The actual animation is too complex, so to demonstrate the issue I just took font-size as an example.
.wrapper > textarea {
font-size: 1em;
transition: font-size 1s linear;
}
The full-screen effect is achieved by this class:
.wrapper.full-screen,
.wrapper.full-screen > textarea {
position: fixed!important;
left: 0!important;
top: 0!important;
width: 100%!important;
height: 100%!important;
margin: 0!important;
border: 0!important;
resize: none!important;
outline: none!important;
font-size: 3em;
}
Full screen function is working fine, but the animation is not working for no clear reason.
If I remove the .wrapper
element or disable the position: fixed
style, the animation magically begins to work again. However I need both of those things, so I can't just get rid of them. Why does either affects animation is beyond me.
Full working sample: https://jsfiddle.net/bypvfveh/3/