Here's an example of what i'm trying to do.
I can't use jquery, can i do this with just pure js and css?
thanks :)
Here's an example of what i'm trying to do.
I can't use jquery, can i do this with just pure js and css?
thanks :)
You should add some code, i'll add some when you do :)
You'll want to use css animations and have the div use a default state of display:none, height: 0;
Then with JS you can add hide the class. This class will display:block, height: 50px
It would have been better if you can provide some code. You can check below codepen code. I have implemented it on CSS hover no js is involved. Check if it helps.
<div class="main">
<div class="next">
</div>
</div>
.main{
min-height:50px;
background-color:red;
transition:all 0.8s ease-out;
margin-bottom:5px;
cursor:pointer;
}
.next{
height:0px;
background-color:green;
transition:all 0.5s ease-out
}
.main:hover{
padding-top:50px;
}
.main:hover .next{
height:50px;
}
http://codepen.io/gauravshankar/pen/ZYjZEd
This can also be done on click if you use a checkbox or a radio button.