jQuery .animate reveal contact form hidden in div with negative margin above header

Posted by brhea on Stack Overflow See other posts from Stack Overflow or by brhea
Published on 2011-01-05T16:49:16Z Indexed on 2011/01/05 16:54 UTC
Read the original article Hit count: 190

Filed under:
|

Hi everyone,

I've got my contact form hidden with a negative margin-top, so that when the visitor clicks "Contact" it reveals the div.

<script type="text/javascript">$("#revealContact").click(function(){
     $("#contact").animate({
          marginTop: "+=620px"
    }, 1000);
});</script>

You can view it live here: http://www.brianrhea.com/index_contact.php -- click Contact link in top right

My problem is that as soon as the form is submitted, it inherits the -620 margin and the success (or error) prompt is invisible.

I'm running in to some other cross-compatibility issues as well with the margin spacing so I'm not even sure this is the best way to go about this. Obviously it'd be great if I could just begin with the div as display:hidden and then animate it to visible, but I haven't been able to do that.

Any input is appreciated, either with advice on how to save the margin after form submission, or suggestion on better method to achieve this hide/reveal.

Thanks, Brian

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about css