jquery – 键入动画文本

我有DIV标签与文本里面.是否可以用打字效果改变循环中的文本内容,在其中输出,然后向后删除字母并以新文本全部开始?这可能是 jquery吗?

解决方法

只是一个简单的方法
var $typer = $('.typer'),txt = $typer.data("text"),tot = txt.length,ch  = 0;

(function typeIt() {   
  if(ch > tot) return;
  $typer.text( txt.substring(0,ch++) );
  setTimeout(typeIt,~~(Math.random()*(300-60+1)+60));
}());
/* PULSATING CARET */
.typer:after {
  content:"";
  display: inline-block;
  vertical-align: middle;
  width:1px;
  height:1em;
  background: #000;
  animation: caretPulsate 1s linear infinite; 
  -webkit-animation: caretPulsate 1s linear infinite; 
}
@keyframes caretPulsate {
  0%   {opacity:1;}
  50%  {opacity:1;}
  60%  {opacity:0;}
  100% {opacity:0;}
}
@-webkit-keyframes caretPulsate {
  0%   {opacity:1;}
  50%  {opacity:1;}
  60%  {opacity:0;}
  100% {opacity:0;}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span class="typer" data-text="Hi! My name is Al. I will guide you trough the Setup process."></span>

所以基本上,jQuery获取元素的数据文本,逐字插入,并且脉冲“插入符号”不是CSS3动画的:在该SPAN的元素之后.

参见:Generate random number between two numbers in JavaScript

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...