selfw是一个模仿打字机效果的jQuery插件,使您能够以固定或随机的速度逐个字符地打印屏幕上的任何文本。
1.下载插件并加载自拍
jQuery之后的脚本。
- <script src="/path/to/cdn/jquery.slim.min.js"></script>
- <script src="/path/to/selfw.js"></script>
2.在现有文本内容上调用该函数,插件将完成其余操作。
- <p id="text">
- Any Text Here
- </p>
- $(function(){
- $("#text").selfw()
- });
3.您还可以在文本
参数
- <p id="text">
- <!-- Empty Container -->
- </p>
- $(function(){
- $("#text").selfw({
- text: 'Your Text Here'
- })
- });
4.自定义打字速度。默认值:100ms。
- $(function(){
- $("#text").selfw({
- time: 200,
- })
- });
5.或者随机改变打字速度。
- $(function(){
- $("#text").selfw({
- random: true
- })
- });