I'm working on an html5 application where I have a fixed header and a fixed footer.
When I click on the footer it should slide up until it is 10pixels away from the header.
Same thing should happen for the header as well.
<div class="header"></div>
<div class="content"></div>
<div class="footer"></div>
The CSS for the default layout is easy: I just use absolute positioning with top and bottom.
.header, .footer {
min-height:25px;
background:grey;
position:absolute;
left:0;
z-index:5;
/** transition **/
transition: all 1s;
}
.header {
top:0;
background:red;
}
.footer {
bottom:0;
background:yellow;
}
.header.max {
bottom:35px;
}
.footer.max {
top:35px;
}
No it comes to the animation part. I don't want to use Javascript animations! ONLY CSS!
If you click on the header or footer I just add the class max
to the element:
$(".header, .footer, .content").on("click", function () {
$(".max").removeClass("max");
$(this).addClass("max");
});
The animation should look like the footer expands from the bottom.
I created a JS-Fiddle. You can see, that the problem happens to be with the top and bottom positioning of the footer/header.
Has anyone an idea how to fix that, so that the animation looks like the footer is expanding from the bottom?
Thanks!