jQuery to achieve a complete code of color typewriter

Effect: Each word is displayed one by one, and each word has a random color

jQuery实现颜色打字机的完整代码

$ (function () { Var str = “The early bird has insects, early worms are eaten by birds! By this talent + diligent = success; the innate is less than the same diligence = or fail! The importance of talent can be seen!”; // Generate 0 Random integer function s () {return parseint (Math.random () * 255) +1);}; var j = 1, i = 0; VAR P = “”; // Open one each 100 Timer VAR K = setInterval (function () {if (j ‘+ n +’
 '; // character string accumulated P = P + HTML; // html () set in element HTML content $ (". Mybox"). HTML (P);} else {// Traversal Complete Close Timer ClearInterVal (k);}}, 100);};  <=str.length){
    //从第一个字开始截取,通过定时器循环遍历字符串的每一个字
    var n=str.substring(i,j);
    j++;
    i++;
    //为单个字添加样式
    var html='   
       $ (Function () {var str = "The early bird has insects, early worms are eaten by birds! By this talent + diligence = success; innate short + equivalent diligence = still failure! The importance of talent can be seen!"; // 0-255 Random Integer Function S () {RETURN PARSEINT ((Math.random () * 255) +1);}; var j = 1, i = 0; VAR P = ""; // Open a onePerform a timer VAR K = setInterval (function () {if (j  '+ n +'  '; // character string accumulated P = P + HTML; // HTML () Setting Element HTML content $ (". Mybox"). HTML (P);} else {// Traversal Complete Close Timer ClearInterVal (k);}}, 100);};   <=str.length){
    //从第一个字开始截取,通过定时器循环遍历字符串的每一个字
    var n=str.substring(i,j);
    j++;
    i++;
    //为单个字添加样式
    var html='     
The entire HTML source code
@charset “UTF- 8 “; / * css document * /. Mybox {height: 200px; border: 5px solid #ddd; font-size: 25px;}

CSS style required
   
This article about jQuery implements a complete code of the color typewriter is introduced, more related jQuery color typewriter content, please search TUMI cloud Previous article or continued to browse the following related articles I hope you will support Tumi clouds in the future!
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment