Skip to content

Commit

Permalink
hide modal on escape #19
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasdavis committed Nov 26, 2012
1 parent 4932ff7 commit 84d43b8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions js/libs/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ define(['jquery'], function ($) {
$('body').append(this.el);



if(options.inline) {
var from = options.inline.from;
var to = $(options.inline.to, this.el);
Expand Down Expand Up @@ -62,10 +63,18 @@ define(['jquery'], function ($) {
};



var create = function (options) {
var Modal = new modal(options);
$('.js-close-modal', Modal.el).on('click', function (){
Modal.hide();
});

$(document).on('keydown', function (ev){
if(ev.which == 27){

Modal.hide();
}
})
return Modal;
};
Expand Down

0 comments on commit 84d43b8

Please sign in to comment.