allow to hide modal on ESC

This commit is contained in:
Felix Niklas 2015-10-28 14:01:21 +01:00
parent 46805b7469
commit 73d0b84779

View file

@ -147,11 +147,11 @@
Modal.prototype.escape = function () {
if (this.isShown && this.options.keyboard) {
this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
$(window).on('keydown.dismiss.bs.modal', $.proxy(function (e) {
e.which == 27 && this.hide()
}, this))
} else if (!this.isShown) {
this.$element.off('keydown.dismiss.bs.modal')
$(window).off('keydown.dismiss.bs.modal')
}
}