This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Ed Nepomuceno
Posted Oct 31 - Read on Facebook

I'm having trouble getting the code for "Enter" to work with http://examples.framerjs.com/#event-keyboard-shortcuts.framer

document.addEventListener('keydown',function(event) {
var key, keyCode;
keyCode = event.which;
key = String.fromCharCode(keyCode);

switch (key) {
case '13':
return myLayer.states.next('max','menu');
break;
};
});

Any insights are much appreciated. Thanks.

4 Comments

Benjamin Den Boer

In this case, you don't have to create a string from the character code:

Erik Edhagen

If you just edit a small error in Benjamins code, replacing "key" with "keyCode", you should be all set

Benjamin Den Boer

Whoops, yes!

Ed Nepomuceno

Thanks so much, guys!

Read the entire post on Facebook