3
I wonder how I can reverse the transition effect of elements with CSS3
$('span').on('click', function(){
if($(this).text() == 'Mostrar Efeito')
{
$('div').css('max-height', '250px');
$(this).text('Resetar');
}
else
{
$('div').css('max-height', '0');
$(this).text('Mostrar Efeito');
}
});
div{
background-color: coral;
width: 200px;
height: 250px;
max-height: 0;
transition: 0.5s;
}
span{
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span>Mostrar Efeito</span>
<div></div>
You can see that in this small example that I created the effect starts from above and goes down. I’d like to know how I can reverse this effect from the bottom up. I tried to find something similar on the internet but without success (I think due to the lack of being able to format the doubt correctly).
In fact it is not going from top to bottom, it is just increasing and so looking for space to shift and "fit", IE all elements will always increase because they start from top in HTML. I could suggest
position: relative
+position: absolute
that will work, but I don’t know exactly what you want.– Guilherme Nascimento
Okay, so it goes up from the top coming down... I want it to go up from the bottom coming up.. As it says in the question
– Bsalvo
Do you understand what I said? From the top down it’s just a feeling, it’s not coming from the top in real, it’s just moving space. I’ll post a suggestion anyway.
– Guilherme Nascimento
I understood what you said, and you also understood what I said.. then we just adapt to our understandings, that we arrived at an answer as did Gabriel, I may have expressed myself in a wrong way but in the end you knew what the doubt was..
– Bsalvo
It’s not a question of one understood the other, the point was just to understand that this is just a perception, the part that said, I don’t know what exactly you want, refers to whether the
position
whether or not it would work for you because I don’t know where on your page you would use it, because adding something like that could break the whole page. You know? But I’m glad it worked out.– Guilherme Nascimento