Skip to content

Instantly share code, notes, and snippets.

@pykotechguy
Created May 29, 2014 05:29
Show Gist options
  • Select an option

  • Save pykotechguy/9dd31e140031bbf820bc to your computer and use it in GitHub Desktop.

Select an option

Save pykotechguy/9dd31e140031bbf820bc to your computer and use it in GitHub Desktop.
escape key press closes your modal float
$(document).keyup(function(e) {
if (e.keyCode == 27) {
view.modalClose();
}
});
// then in your backbone view
//...
modalClose: function() {
/*
var height = GetHeight() * 0.5;
var width = GetWidth() * 0.8;
var margleft = GetWidth() * 0.10;
var margright = GetWidth() * 0.10; (these were used for creating modal height/width when opening overlay modal)
*/
$("div.modal").slideUp("fast").hide().empty();
},
//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment