This time I will bring you JS custom status bar animation text, what are the precautions for JS custom status bar animation text, the following is a practical case, Let’s take a look.
Open in IE browser to display the effect of dynamic text, mainly the text in the lower left corner of the browser.
<body onload="stack();"> <script type="text/javascript"> var statusText="自定义动画状态栏文字"; var out=""; var pause=100; var animateWidth=20; var position=animateWidth; var i=0; var stack=function(){ if(statusText.charAt(i)!=" "){ out=""; for(var j=0;j<i;j++){ out+=statusText.charAt(j); } for(j=i;j<position;j++){ out+=" "; } out+=statusText.charAt(i); for(j=position;j<animateWidth;j++){ out+=" "; } window.status=out; if(position==i){ animateWidth++; position=animateWidth; i++; }else{ position--; } }else{ } if(i<=statusText.length){ setTimeout("stack()",pause); } } </script> </body>
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Npm makes cli command line tool
js implements a simple 24-hour clock
The above is the detailed content of JS custom status bar animated text. For more information, please follow other related articles on the PHP Chinese website!