Examples
Sample#1
Sample#2
<button type="button" class="btn btn-default" id="demo2">...</button>
<script>
$(function(){
var demo2 = $('#demo2');
demo2.colorpickerplus();
demo2.on('changeColor', function(e){
if(e.color==null) {
//when select transparent color
$('.color-fill-icon', $(this)).addClass('colorpicker-color');
} else {
$('.color-fill-icon', $(this)).removeClass('colorpicker-color');
$('.color-fill-icon', $(this)).css('background-color', e.color);
}
});
});
</script>
Sample#3
Sample#4
<div class="btn-group btn-group-sm colorpickerplus-dropdown" id="demo4">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">...</button>
<ul class="dropdown-menu">
<li class="disabled"><div class="colorpickerplus-container"></div>
</li>
<li>...</li>
</ul>
</div>
<script>
$(function(){
var demo4 = $('.colorpickerplus-dropdown .colorpickerplus-container');
demo4.colorpickerembed();
demo4.on('changeColor', function(e){
var el = $('.color-fill-icon', $('#demo4'));
if(e.color==null) {
//when select transparent color
el.addClass('colorpicker-color');
} else {
el.removeClass('colorpicker-color');
el.css('background-color', e.color);
}
});
});
</script>