Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close on 'Esc' key press? #14

Open
joshgillies opened this issue Apr 26, 2012 · 1 comment
Open

Close on 'Esc' key press? #14

joshgillies opened this issue Apr 26, 2012 · 1 comment

Comments

@joshgillies
Copy link

I'm wondering whether adding this feature to leanModal.js would be worthy?

I for one love being able to dismiss things that "popup" from webpages by attacking my Esc key, and am somewhat depressed that this isn't currently included in this project.

Given that supporting such a thing wont add too much to the code base (thus keeping the 'lean' approach to a modal intact), I for one feel as though it would be a worthy addition.

@pablfr
Copy link

pablfr commented May 2, 2012

Add this on line 30 :

                $(document).keydown(function(e) {
                if (e.keyCode == 27) {
                 close_modal(modal_id);
                }
                });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants