javascript逐字输出案例
- //动态文字提示
- var txtArr = ['欢迎来到BETWAY官网网,官网地址:https://www.nucmc.com/', '专注WebBETWAY登录开发与PHP编程设计'],
- x = 1,
- y = 0,
- txt = txtArr[y],
- timer = null,
- timer1 = null,
- cue = $('.menutext');
- function changTxt() {
- if (x == txt.length+1) {
- clearTimeout(timer1);
- timer1 = setInterval(function(){
- y += 1;
- if (y > txtArr.length - 1) y = 0;
- cue.text('');
- txt = txtArr[y];
- x=0;
- },5500);
- }
- cue.text(txt.substring(0,x));
- x+=1;
- clearTimeout(timer);
- timer = setTimeout(function(){
- changTxt();
- },600);
- }
- changTxt();
TAG:javascript 逐字输出
本站欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明: 文章转载自:BETWAY官网网 https://www.nucmc.com/show-12-892-1.html
转载请注明: 文章转载自:BETWAY官网网 https://www.nucmc.com/show-12-892-1.html