JS Pure Digital Stop display effect of the implementation code _JAVASCRIPT skills

Source: Internet
Author: User
Tags pow

Implementation code for

JS pure digits to stop display effects

function Showscore ($ele, num, Secand, pause) {//second How many seconds the animation runs per second if (!secand) {secand = 2;}

        if (!pause) {pause = 20;}

        var len = String (num). length;
        var temnum, times = 0, steptimes, Max;


        var Numarr = String (num). Split (""); function Getrandom (n) {var = math.floor (Math.random () * (Math.pow (n) -1-math.pow (n-1)) +math.pow (n

          -1));

          if (String (num). length!== n) {num = Getrandom (n);}
        return num;

          function SetValue (num, pause, Secand) {//second How many seconds to run to stop var len = String (num). length, j=0;
            if (!steptimes) {max = Math.ceil (Secand*1000/len);
          Steptimes = Math.ceil (Max/pause);
          } temnum = "";
                settimeout (function () {for (var i = 1; I <= len; i++) {if (Times >= steptimes*i) {
                j + +;
              Temnum + + numarr[i-1]+ "";
      }else{          Break

            }
            };
            if (J < len) {$ele. html (temnum+ "" +getrandom (len-j));
            }else{$ele. html (temnum);

            } if (Times >= max | | J >= len) {return;};
            SetValue (num, pause, secand);
            
          times++;


        }, pause);

      } setValue (num, pause, secand); } showscore ($ (". Num"), 2344, 1.5, 10);

The effect of pure numbers to stop the display effect, such as the number of constant changes, the first set down first, the second to determine, and then the third to determine. Because the project took a few days to retire, so save the file.

The above JS pure number of the display to stop the implementation code is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud-dwelling community.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.