Skip to content

Instantly share code, notes, and snippets.

@stakes
Created April 6, 2011 22:58
Show Gist options
  • Save stakes/906713 to your computer and use it in GitHub Desktop.
Save stakes/906713 to your computer and use it in GitHub Desktop.
$('.colorpicker').bind('click', function(evt) {
var tgt = $(this);
tgt.parent().prepend('<div id="colorpicker-overlay"></div>');
$('#colorpicker-overlay').farbtastic(function() {
// handle form update
tgt.val(this.color);
tgt.css('background-color', this.color);
// update object
CSTM.colors[tgt.attr('id')] = this.color;
// handle live preview
livepreviewColors(tgt.attr('id'), this.color);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment