add closing of modal on escape key and clicking outside

This commit is contained in:
Hendrik
2017-02-02 15:51:27 +01:00
parent cfa7c870f0
commit afb45d6709

View File

@@ -83,6 +83,21 @@ $(window).on("load", function() {
loadMorePosts(userID, groupID, postAmount, postLimit); loadMorePosts(userID, groupID, postAmount, postLimit);
} }
}; };
$(document).keyup(function(e) {
if (e.keyCode == 27) {
closeModal();
}
});
$('.modal').click(function() {
closeModal();
});
$('.modal-content').click(function(event){
event.stopPropagation();
});
}); });
function closeModal() { function closeModal() {