Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect FN-Key on Mac using Javascript

i want to capture the fn-key on the Mac keyboard in my CMS application. Binding an event to the key and logging the codes showed me that the keycode returned by the fn-key is 0 (zero).

I am tempted to take that as a given - but before i implement this, i wanted to check back with you guys and see whether you think this is the correct code for this key or if it merely means the system has no idea how to interpret that specific key event.

Would be great to get some input here.

Thanks!

like image 305
SquareCat Avatar asked Nov 26 '11 16:11

SquareCat


1 Answers

I could be wrong here, but I think you won't really be able to capture the Fn key like you would the CTRL key. Fn + some other key will trigger the actual keydown or keypress since it's there to allow you to hit the F1-F12 keys. You might be able to use the shift key, but make sure that it doesn't do a text selection.

In jQuery I would do $("#my-element").disableSelection() and then see if the Shift + click works the way you want it to.

like image 166
Adrian Rodriguez Avatar answered Sep 29 '22 11:09

Adrian Rodriguez