非常に基本的な質問ですが、うまくいきません。私はこのコードスニペットを持っています:
$('.cube').each(function(i) {
var nleft = $(this).offset().left;
var ntop = $(this).offset().top;
var tbg = $(this).css('backgroundColor');
//output
var cval = $('#output');
cval.val(cval.val()+'cubes['+i+'].animate({left:'+nleft+',top:'+ntop+',backgroundColor:'+tbg+'});');
});
これにより、div-array のさまざまな属性がログに記録されます。問題は背景色です:
cubes[1].animate({left:200,top:200,backgroundColor: transparent });
これはログであり、ご覧のとおり、これを他の場所で使用できる必要transparent
があり' '
ます。backgroundcolor が の場合と同じように#000
、string-marks を使用する必要があります。