How to make div slidedown

Shawn Ily Holman picture Shawn Ily Holman · Jul 27, 2011 · Viewed 9.8k times · Source

Sorry I'm really new to JQUery and would like to know how do I make an Div Slide Down?

JQuery is confusing to me and really just need help

Answer

Jasper picture Jasper · Jul 27, 2011

HTML

<a id="click_to_slide">Click To Slide Down</a>
<div id="slide_me_down"></div>

CSS

#slide_me_down {
    display: none;
    width: 100px;
    height: 100px;
    background-color: #000;
}

JAVASCRIPT

$(document).ready(function () {
    $('#click_to_slide').live('click', function () {
        $('#slide_me_down').slideDown();
    });
});

Here is a jsfiddle of the above code: http://jsfiddle.net/EfmeW/

Also if you want to have the div slideUp and Down depending on whether or not the div is already visible or not you can use .slideToggle() instead of .slideDown()