Skip to content

Instantly share code, notes, and snippets.

@ajpiano
Forked from bebraw/gist:359230
Created Apr 7, 2010
Embed
What would you like to do?
// 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