我使用ColorPicker Plugin.我初始化下面的代碼插件:
$(".colorpic").ColorPicker({
color: '#0000ff',
onShow: function (colpkr) {
$(colpkr).fadeIn(500);
return false;
},
onHide: function (colpkr) {
$(colpkr).fadeOut(500);
return false;
},
onChange: function (hsb, hex, rgb) {
$(this).css('backgroundColor', '#' + hex); <= $(this) not working
}
});
現在我的問題是,$(this)
不onchange
事件工作。請幫我嗎?
也許你需要'綁定this'爲'onChange'? – tkone
插件不會將其上下文傳遞給'onChange'方法。打開一個問題:) – Terry