May 2, 2012

slide down effect with jquery

Question by Thomas

suppose i have one div which has data. i want when i will click on a button then a new div will be created and which will cover the actual div like shutter down. here is sample code i got from a site which is very close but not the way i want.

    $(document).ready(function() {
  var $box = $('#box')
    .wrap('<div id="box-outer"></div>');
  $('#blind').click(function() {
    $box.blindToggle('slow');  
  });    
});

check the demo of above code http://www.learningjquery.com/2008/02/simple-effects-plugins
just go to site and click on blind toggle button just to see how i want the things.
i want when button will be click then a new div will be created and the new div will cover the actual div with slide down effect and when i will click again then new div will slide up.how to implement it using jquery. guide me with sample code if possible. thanks

Answer by kei

The link you’ve provided pretty much have the code already for you. You just need a few tweaks.

demo:
http://jsfiddle.net/dACjL/

Answer by Starx

There are already native function .slideUp() and .slideDown() which do what you want.


Update: Not sure if i understood it correctly but, here is a demo.

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!