作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我基本上想在 HTML 页面中创建一个简单的 Javascript 自动编写器这是我的代码:
<html>
<head>
<style>
#type {
display: inline-block;
}
#cur {
display: inline-block;
}
</style>
</head>
<body>
<pre>
<div id="type"></div><div id="cur">{cursor}</div>
</pre>
<script>
var string = "Write this string!\nNext Line!";
var array = string.split("");
var timer;
function looper() {
if (array.length > 0) {
document.getElementById("type").innerHTML += array.shift();
} else {
clearTimeout(looper);
}
timer = setTimeout('looper()', 50);
}
looper();
</script>
</body>
</html>
字符串“{cursor}”应该是光标位置,我稍后会创建它。它的问题是当我换行时;本质上,光标不会返回到该行的初始位置,而是保持到它最后一次“跳转”到下一行的位置。
最佳答案
本网站可能对您有所帮助https://macarthur.me/typeit/
你可以使用 jquery 试试这个:
<p id="example3"></p>
$('#example3').typeIt({
strings: ["This is a great string.", "And here we have another great string.."],
speed: 50,
autoStart: false
});
关于javascript - 带有光标 Javascript 的自动打字机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45383388/
我有一个用例,我必须通过他的出生日期从数据库中检索用户记录。 问题是我们将用户的出生日期存储为 datetime 对象,这使得检索用户数据变得非常困难,因为我们无法提供带时间戳的确切日期。 我尝试在
目前我正在使用 Typewriter 从我的 C# 类自动生成 TypeScript 类。假设我有这个非常简单的 C# 类: [Dto] public class MyDto { public
我在 Codepen 上使用了一个模拟字体效果的脚本。 http://codepen.io/hi-im-si/pen/DHoup . 尝试创建一个简单的开始/停止按钮。我已经添加了暂停 svg 按钮和
点击有click.ParamType ,用于定义自定义参数类型,但它不适用于 typer(下面的示例片段) 我想使用我自己的日期时间格式,例如:今天 %H:%M、%M:%H(自动将日期用作今天)。 T
我是一名优秀的程序员,十分优秀!