I have one div and a button.
When the button is clicked, I am appending another div. After appending the second div, I want to add a slide-up animation to the first div and a slide-down animation to the second using jQuery.
<div class="main">
<div class="user">
<div class="closed_div">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</div>
<button class="addDiv">Add open Div</button>
</div>
Now, I am appending the new div using the code below
$(document).ready(function(){
$('.addDiv').click(function(){
var html = '<div class="open_div">Lorem Ipsum is simply dummy text of the printing and \n\
typesetting industry. Lorem Ipsum has been the industrys \n\
standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type \n\
specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining \n\
essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, \n\
and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>';
$('.user').append(html);
});
});
And animate with the following code
$(".closed_div").animate({height:'100%','opacity':1},1500);
$(".open_div").animate({height:0},1500);
However, it's not working well. Can you suggest what I might be doing wrong?
Thank you.