I’m interested in using JS events such as right\left arrow, space bar etc.
Wondering what’s the right way to do it. I would like to slide photos, make DIVs appear etc. on such user interactions.
I thought of possible implementations with jQuery such as http://api.jquery.com/event.which/
Though I’m not sure that’s the best way.
Here are two good examples for such UI implementations
(How do they do it?)
http://www.thesixtyone.com ;
http://www.pictorymag.com/showcases/summer-jobless
I’m more a C# person, looking for the right direction to dig in.
If you’re already using jQuery or plan to, taking advantage of
whichis not a bad idea. If you look at the example, it shows you exactly how to do it. Put your cursor in the text field there and press the key that you’re interested in, i.e. left arrow. The number that is displayed inkeydown:is the code you’re looking for.Now, when you write your own function, you might bind
keydownto thedocumentand listen for the correct keys. From there, you can dispatch certain behaviors depending on which key was pressed.You asked how sites like Pictorymag.com handle this functionality. Here’s what Pictorymag.com does (I’ve decompressed their code to make it easier to read):