JavaScript

    var re = document.getElementById("fonts");
    var res =re.getElementsByTagName("p");
        console.log(res);
        // 利用闭包闪现传参,延时
        for(var i=0; i<res.length; i++){    
            setTimeout((function(i){
                return function(){
                    res[i].style.opacity=1;
                }
            })(i),i*2000);
        }   
创建多个定时器,传入参数
原文地址:https://www.cnblogs.com/jiayu123/p/10598302.html