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

Can't get keypress on body of document. #62

Open
txrev319 opened this issue Sep 28, 2013 · 2 comments
Open

Can't get keypress on body of document. #62

txrev319 opened this issue Sep 28, 2013 · 2 comments

Comments

@txrev319
Copy link

I'm using Enfocus-2.0.00-SNAPSHOT

With the ode block

"body" (efe/listen :keypress (fn [&args](. js/console log args) ))

I can't get key presses on the body of the document. yet, if I do

"#button1" (efe/listen :click (fn [&ags](. js/console log args) ))

everything works fine.

Question: how do I register a global key listener (I want left/right arrow keys to move slides).

Thanks!

@ckirkendall
Copy link
Owner

@txrev319 I did this very thing when I build clj-prezo. below is the code I used. I will do some testing with :keypress in my code I used :keydown

(defn enable-nav-keys []
  (em/at js/document (em/listen :keydown #(exec-action! (.-keyCode %)))))

@txrev319
Copy link
Author

@ckirkendall: worked, thanks!

(fyi: I could have sworn I tried that, but for some reason, it didn't work last time.)

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