打字效果

Home文章
 简介:给博客加段文艺的话,打印机效果
            function bannerText(p,delay){
                var s = p.text();
                var cur = 0;
                setInterval(function () {
                    cur++;
                    if(cur <= s.length){
                        p.text(s.substring(0,cur));
                    }
                    if(cur>delay){
                        cur=0;
                    }
                },100);
            }
            new bannerText($('.banner p'),100);

 



评论
Login