Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 31st, 2012  |  syntax: None  |  size: 0.62 KB  |  hits: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Color change event handling in jpicker
  2. $('#colorSelector').jPicker(
  3.                 {
  4.                     window:{expandable:true}
  5.                 });
  6.        
  7. <span id="colorSelector"></span>
  8.        
  9. $('#Callbacks').jPicker(
  10.         {},
  11.         function(color, context)
  12.         {
  13.           var all = color.val('all');
  14.           alert('Color chosen - hex: ' + (all && '#' + all.hex || 'none') + ' - alpha: ' + (all && all.a + '%' || 'none'));
  15.           $('#Commit').css(
  16.             {
  17.               backgroundColor: all && '#' + all.hex || 'transparent'
  18.             }); // prevent IE from throwing exception if hex is empty
  19.         }
  20. );