Punctuation loading “animation”, javascript?

后端 未结 4 1443
甜味超标
甜味超标 2021-02-19 17:52

I\'m looking for a good way to display some punctuation loading \"animation\".

What I want is something like this:

This will display at second 1: \"Waiti         


        
4条回答
  •  春和景丽
    2021-02-19 18:32

    Now sure how the code got out of hand, you could just do:

    setInterval(function () {
      var span = $("#text-loader").children("span:eq(0)");
      var ellipsis = span.html();
      ellipsis = ellipsis + ".";
      if (ellipsis.length > 5) {
        ellipsis = ".";
      }
      span.html(ellipsis);
    }, 1000);
    
    
    This will display at second 1: "Waiting for your input.

    And as for the 1, you can swap that out with the number of periods.

提交回复
热议问题