Skip to content

Instantly share code, notes, and snippets.

@bebraw
Created April 7, 2010 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bebraw/359230 to your computer and use it in GitHub Desktop.
Save bebraw/359230 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) {
if( $('.activeColor').prev() ) {
console.log('setting prev');
$('.activeColor').prev().focus();
}
});
shortcut.add('w', function(e) {
if( $('.activeColor').next() ) {
console.log('setting next');
$('.activeColor').next().focus();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment