我在 foreach 循环中使用 jquery$("#" + theidoftheelement).animate(...)来为一个元素设置动画,但只有最后一个动画有效……请帮忙!
编辑:更多代码:(txt是文件中的小文本)
 txt.forEach(function (lcb) {
                    lcb = lcb.split("   ", 30);
                    var header = document.createElement('h3');
                    header.id = 'Infralist_' + lcb[2];
                    header.className = 'Infraa';
                    header.textContent = lcb[2];
                    document.getElementById("MainContent_Infralist").appendChild(header);
                    $('#' + lcb[2]).animate({ opacity: "1" }, 500);
                window.scrollTo(0, document.body.offsetWidth);
                initlist(runstr);};`