我正在尝试在 javascript 中采用灵活的参数来使用 eyecon colorpicker ( www.eyecon.ro/colorpicker/ )操作颜色
但是,当我尝试更改页面的颜色时,它会卡在 arguments.length 循环中吗?
html是:
<div class="colorSelector" id="colorSelector3"><div style="background-color: #0000ff"></div></div>
jquery/javascript 是:
$('#colorSelector3').click(function(){
colorPickDynamic('#colorSelector3','h1','color');
});
function colorPickDynamic(cp){
var i;
var j;
for (x=0, i = 1, j = 2; j < arguments.length; i+2, j+2, x++) {
var tag = [];
var colorProperty = [];
tag[x]=arguments[i];
colorProperty[x]=arguments[j];
}
$(cp).ColorPicker({
color: '#0000ff',
onShow: function (colpkr) {
$(colpkr).fadeIn(500);
return false;
},
onHide: function (colpkr) {
$(colpkr).fadeOut(500);
return false;
},
onChange: function (hsb, hex, rgb) {
$(tag[0]).css(colorProperty[0], '#' + hex);
$(cp + ' div').css('backgroundColor', '#' + hex);
}
});
}
任何帮助都会很棒!谢谢