I have following code:
HTML:
<div id="container">
text text text
</div>
<img id="img1" src="img1.png" />
<img id="img2" src="img2.png" />
CSS:
#container {
display: block;
margin-top: 0vh;
transition: margin-top 1s ease-in 0.1s, display 0.1s linear 5s ;
}
JS:
$("img#img1").on('click', function () {
$("#container").css('margin-top', '50vh');
$("#container").css('display', 'none');
});
$("img#img2").on('click', function () {
$("#container").css('margin-top', '0vh');
$("#container").css('display', 'block');
});
Looking on CSS file, my intention is:
- margin-top property, change after 0.1 second, for 1 second
- display property, change after 5 second, for 0.1s
But it doesn't work. The display property is changed immediately after click on image.
How to fix it?