javascript文字逐字输出精简案例

导语 javascript逐字输出案例 动态文字提示vartxtArr=[& 39;欢迎来到BETWAY官网网,官网地址:http: www aseoe com & 39;,& 39;专注WebBETWAY登录开发与PHP编程设计& 39;],x=1,y=0,txt=txtArr[y],timer=null,timer1=null,cu

javascript逐字输出案例

  1. //动态文字提示 
  2.             var txtArr = ['欢迎来到BETWAY官网网,官网地址:https://www.nucmc.com/''专注WebBETWAY登录开发与PHP编程设计'], 
  3.                 x = 1, 
  4.                 y = 0, 
  5.                 txt = txtArr[y], 
  6.                 timer = null
  7.                 timer1 = null
  8.                 cue = $('.menutext');  
  9.             function changTxt() { 
  10.                 if (x == txt.length+1) { 
  11.                     clearTimeout(timer1); 
  12.                     timer1 = setInterval(function(){ 
  13.                         y += 1; 
  14.                         if (y > txtArr.length - 1) y = 0; 
  15.                         cue.text(''); 
  16.                         txt = txtArr[y]; 
  17.                         x=0; 
  18.                     },5500);                     
  19.                 } 
  20.                 cue.text(txt.substring(0,x)); 
  21.                 x+=1; 
  22.                 clearTimeout(timer); 
  23.                 timer = setTimeout(function(){ 
  24.                     changTxt(); 
  25.                 },600); 
  26.             } 
  27.             changTxt(); 

 点击查看案例

https://www.nucmc.com/ true javascript文字逐字输出精简案例 https://www.nucmc.com/show-12-892-1.html report 2654.5 javascript逐字输出案例 动态文字提示vartxtArr=[& 39;欢迎来到BETWAY官网网,官网地址:http: www aseoe com & 39;,& 39;专注WebBETWAY登录开发与PHP编程设计& 39;],x=1,y=0,txt=txtArr[y],timer=null,timer1=null,cu
TAG:javascript 逐字输出
本站欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明: 文章转载自:BETWAY官网网 https://www.nucmc.com/show-12-892-1.html
BETWAY官网网 Copyright 2012-2014 www.nucmc.com All rights reserved.(晋ICP备13001436号-1)