Skip to content

Instantly share code, notes, and snippets.

@ajpiano
Forked from bebraw/gist:359230
Created April 7, 2010 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajpiano/359233 to your computer and use it in GitHub Desktop.
Save ajpiano/359233 to your computer and use it in GitHub Desktop.
// HTML structure
for( var i = 0; i < AMOUNTOFCOLORS; i++ ) {
$('#colors').append('<li> \
<input style="width: 1em; height: 1em;" class="clickableColor" /> \
</li>');
}
$('.clickableColor :first').addClass('activeColor');
// shortcuts for changing color. XXX: selector fails!
shortcut.add('q', function(e) {
var prev = $(".activeColor").prev();
prev.length && prev.focus();
});
shortcut.add('w', function(e) {
var next = $(".activeColor").next();
next.length && next.focus();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment