From 428f7599dda04fb6529a04ccdfb66c8e8706d2bf Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Tue, 3 Feb 2015 22:01:38 +0100 Subject: [PATCH] Small animations when adding/removing email fields --- public/js/vroom.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/js/vroom.js b/public/js/vroom.js index 6527ef7..f69a9d3 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -178,10 +178,11 @@ function maxHeight(){ function addEmailInputField(val){ var parentEl = $('.email-list'), currentEntry = parentEl.find('.email-entry:last'), - newEntry = $(currentEntry.clone()).appendTo(parentEl); + newEntry = $(currentEntry.clone()).css('display', 'none').appendTo(parentEl); newEntry.find('input').val(val); newEntry.removeClass('has-error'); adjustAddRemoveEmailButtons(); + newEntry.show(100); } // Adjust add and remove buttons foir email notifications function adjustAddRemoveEmailButtons(){ @@ -201,7 +202,11 @@ $(document).on('click','button.btn-add-email',function(e){ }); $(document).on('click','button.btn-remove-email',function(e){ e.preventDefault(); - $(this).parents('.email-entry:first').remove(); + el = $(this).parents('.email-entry:first'); + el.hide(100); + setTimeout(function(){ + el.remove(); + }, 100); }); // Handle owner/join password confirm