Small animations when adding/removing email fields

master
Daniel Berteaud 10 years ago
parent 9b2ea8d78d
commit 428f7599dd
  1. 9
      public/js/vroom.js

@ -178,10 +178,11 @@ function maxHeight(){
function addEmailInputField(val){ function addEmailInputField(val){
var parentEl = $('.email-list'), var parentEl = $('.email-list'),
currentEntry = parentEl.find('.email-entry:last'), 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.find('input').val(val);
newEntry.removeClass('has-error'); newEntry.removeClass('has-error');
adjustAddRemoveEmailButtons(); adjustAddRemoveEmailButtons();
newEntry.show(100);
} }
// Adjust add and remove buttons foir email notifications // Adjust add and remove buttons foir email notifications
function adjustAddRemoveEmailButtons(){ function adjustAddRemoveEmailButtons(){
@ -201,7 +202,11 @@ $(document).on('click','button.btn-add-email',function(e){
}); });
$(document).on('click','button.btn-remove-email',function(e){ $(document).on('click','button.btn-remove-email',function(e){
e.preventDefault(); 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 // Handle owner/join password confirm

Loading…
Cancel
Save