-
-
Save brasofilo/6398219 to your computer and use it in GitHub Desktop.
From http://theme.fm/2011/08/using-the-color-picker-in-your-wordpress-theme-options-2152/ . See: http://stackoverflow.com/q/7954267
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="text" name="my-theme-options[color]" id="color" /> | |
<input type='button' class='pickcolor button-secondary' value='Select Color'> | |
<div id='colorpicker' style='z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;'></div> | |
// Color Picker for js file | |
$('.pickcolor').click( function(e) { | |
colorPicker = jQuery(this).next('div'); | |
input = jQuery(this).prev('input'); | |
$(colorPicker).farbtastic(input); | |
colorPicker.show(); | |
e.preventDefault(); | |
$(document).mousedown( function() { | |
$(colorPicker).hide(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment