Earl Larson Earl Larson - 1 year ago 52
HTML Question

How to create sliding DIV on click?

I am looking to create a slide out DIV, like the one here when you press "Contact". Does anybody know of anything similar to this?

Answer Source

Making use jQuery's slideToggle() method could help you do this.

Example

HTML:

<div id="contact">
    Contact me!
</div>
<a href="#" id="toggle">Contact</a>

CSS:

#contact
{
    display: none;
    background: grey;
    color: #FFF;
    padding: 10px;
}

JavaScript:

$(function()
{
     $("a#toggle").click(function()
     {
         $("#contact").slideToggle();
         return false;
     }); 
});