Okay. Got it working….
I used the simple version:
add_filter( 'admin_post_thumbnail_html', 'basic_add_opacity_to_feature_thumb_box'); //same as before
function basic_add_opacity_to_feature_thumb_box( $myhtml ) {
$selected_option = get_post_meta( get_the_ID(), 'basic_opacity', true ); // get the current value
for ( $i = 0; $i <= 1; $i = $i + 0.1 ) { //loop from 0 to 1 in 0.1 increments
$selects .= '<option value="' . $i . '" ' . selected( $selected_option, $i, false ) . '>' . $i . '</option>'; //add a option field, and select it if it is the one saved before
}
//create the return html, with the selects created before
return $myhtml .= '
<script src="'.get_bloginfo('template_directory').'/js/jscolor.js"></script>
<form>
Transparantie:
<select name="basic_opacity">
' . $selects . '
</select><br><br>
Kleur:
<div id="color">
<input id="colorpicker" class="jscolor {onFineChange:"update(this)"}" value="FFFFFF">
<div id="selected_color"></div>
</div>
</form>
<script type="text/javascript">
jQuery(document).ready(function($){
$("input#colorpicker").change(function() {
var contentString =$("input#colorpicker").css("background-color");
$("#selected_color").html(contentString);
});
});
</script>
';
}
After the color is selected I output the content (in RGB) to an empty div.