Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var template = "<p>I've replaced the button<br>and in a very smooth<br>fashion!</p>";
- var doAnimation = function(e) {
- var parent = $(this).parent();
- var oldHeight = parent.height();
- $(this).fadeOut(400, function() {
- this.remove();
- var paragraph = $(template).appendTo(parent);
- var newHeight = parent.height();
- paragraph.hide().fadeIn();
- parent.height(oldHeight).animate({height: newHeight});
- });
- }
- $(document).on('click', 'button', doAnimation);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement