我怎樣才能使這個乘法工作? 3號線.thx乘法百分比和變量
$("div").each(function(i) {
$(this).animate({
left: "25%" * i //no idea how to concatenate this
},1300)
我怎樣才能使這個乘法工作? 3號線.thx乘法百分比和變量
$("div").each(function(i) {
$(this).animate({
left: "25%" * i //no idea how to concatenate this
},1300)
$("div").each(function(i) {
var perc = (25 * i) + "%";
$(this).animate({
left: perc //no idea how to concatenate this
},1300)
嘗試這種方式
和如果u使用jQuery - 更好地將
$.each($("div"), function(i, v) {
var perc = (25 * i) + "%";
$(v).animate({
left: perc //no idea how to concatenate this
},1300);
});
試試這個
$("div").each(function(i) {
$(this).animate({
left: (25 * i) + '%'
},1300)
希望這有助於
「25%」是文字,它是沒有意義的,試圖乘以它 – 2015-04-04 14:48:41
@George Jempty,這就是爲什麼我寫了一個評論efter .... – Noobest 2015-04-04 16:32:56