From af76dfad695975ed4101356c1b552da8a1ae62d8 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Sun, 6 Nov 2011 17:22:29 -0800 Subject: [PATCH] smoother transitions --- src/modal.coffee | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/modal.coffee b/src/modal.coffee index 88565552c..01768c598 100644 --- a/src/modal.coffee +++ b/src/modal.coffee @@ -26,15 +26,16 @@ class Modal $(document).bind 'keydown.modal', (e) => if e.keyCode is (esc = 27) then @hide(); false - $('#modal-overlay') - .css('opacity', 0.2) - .fadeIn(200) - .click => @hide() - $('body').append $(@template).hide() $('#modal .content').append @html - $('#modal').fadeIn 200 - @resize() + + $('#modal-overlay') + .css('opacity', 0.2) + .click(=> @hide()) + .fadeIn 200, => + $('#modal').fadeIn(200) + $('#modal input').focus() + @resize() Event.trigger 'modal:show', @ @@ -45,7 +46,7 @@ class Modal hide: -> @showing = false - $('#modal').fadeOut -> $(this).remove() + $('#modal').remove() $('#modal-overlay').fadeOut 200, -> $(this).remove() $(document).unbind '.modal' $(window).unbind '.modal'