如何将此代码从“每个”重写为“为”:
myDiv.scroll(function () {
$nower = (($(this).scrollTop() + $start_pr) / $skorost) + $ugol * 8;
$.each(ImgDiv, function(index) {
$(this).offset({ top: Math.cos((index + 1) * $ugol + $nower) * $size_dug + $smes_y, left: Math.sin(-((index + 1) * $ugol + $nower)) * $size_dug + $smes_x });
});
});
我正在尝试,但它不起作用:=(
myDiv.scroll(function () {
var $nower = (($(this).scrollTop() + $start_pr) / $skorost) + $ugol * 8;
for (var ink = 0, len = ImgDiv.length; ink < len; ink++) {
ImgDiv[ink].offset({top: Math.cos((ink + 1) * $ugol + $nower) * $size_dug + $smes_y, left: Math.sin(-((ink + 1) * $ugol + $nower)) * $size_dug + $smes_x });
};
});