fix dom event binding in modals

This commit is contained in:
Chris Wanstrath
2011-11-13 02:01:17 -08:00
parent b5092c88d1
commit 2caada130f
2 changed files with 3 additions and 4 deletions

View File

@@ -32,8 +32,6 @@ class ModalSelector extends Modal
style.appendChild rules
head.appendChild style
$('#modal-selector input').live 'keydown.modal-selector', @onKeydown
onKeydown: (e) =>
keys = up: 38, down: 40, enter: 13
@@ -50,6 +48,7 @@ class ModalSelector extends Modal
show: ->
super
@filter()
$('#modal-selector input').live 'keydown.modal-selector', @onKeydown
hide: ->
super

View File

@@ -24,13 +24,13 @@ class Modal
style.appendChild rules
head.appendChild style
$(window).bind 'resize.modal', => @resize()
show: ->
@showing = true
$('body').append('<div id="modal-overlay"></div>')
$(window).bind 'resize.modal', => @resize()
$(document).bind 'keydown.modal', (e) =>
if e.keyCode is (esc = 27) then @hide(); false