I have a simple problem but I am not sure how to solve it.
Basically I have some hidden content that, once expanded, requires a height of 99px. While collapsed the element holding it section#newsletter is set to be 65px in height.
LIVE EXAMPLE: http://dev.supply.net.nz/asap-finance-static/
On the click of a#signup_form the section#newsletter is expanded to 99px using the following jQuery:
$('#newsletter_form').hide(); // hide the initial form fields
$('#form_signup').click(function(event) {
event.preventDefault(); // stop click
// animate
$('section#newsletter').animate({height: 99}, 400, function() {
$('#newsletter_form').show(300);
})
});
All this works great except for the fact that this element sits in a sticky footer so its initial height is used to position it.
Animating the height of this element causes scrollbars on the browser, because the 34px added are added to the bottom of the element, so my question:
How can I add these 34px to the top of the element so the height expands upwards into the body not downwards?
Thanks for reading,
I look forward to your help and suggestions.
Jannis
just to post the complete solution to my specific problem in case this may help others, here is the code:
JS:
CSS: (this is the sticky footer i am using)
So basically I am positioning my
footeras I would normally with the full height of the TOTAL (after animation height) and then I push down the initial content via margin-top to compensate for the lesser value in height when theyour_containeris collapsed.Then on animate both the height of
your_containeris adjusted and the margin-top onyour_containerandfooter&.pushare removed.Hope this helps someone else when they stumble upon this.
J.