文本/链接

超逼真的控制台打字jQuery特效

阿里云

typewriting 是一款可以制作超逼真控制台打字特效的 jQuery 插件。该插件使用简单,你可以设置任何你想打印输入的文字内内容,可以设置打字速度和光标闪烁的频率等。

HTML 结构:

该打字特效的 HTML 结构使用一个空的[div]来制作即可。

也想出现在这里?联系我们
创客主机
  1. <div class="terminal"></div>

CSS 样式:

为了效果更加逼真,你可以为这个打字效果添加一些 CSS 样式。

  1. body {
  2.   width: 100%;
  3.   margin: 0px;
  4.   font-family: 'Helvetica Neue';
  5.   background-color: #020202;
  6. }
  7.  
  8. .terminal {
  9.   width: 60%;
  10.   font-size: 26px;
  11.   color: #00fd55;
  12.   letter-spacing: 2px;
  13.   position: absolute;
  14.   top: 50%;
  15.   left: 20%;
  16. }
  17.  
  18. .terminal::before {
  19.   content: ">";
  20.   margin-right: 10px;
  21. }

JAVASCRIPT 代码:

在页面 DOM 元素加载完毕之后可以通过下面的方法来初始化该控制台打字特效插件。

  1. $('.terminal').typewriting( "Hello World!", {
  2.  
  3.   // default: 150
  4.   "typing_interval": 200,
  5.  
  6.   // default: 0.7s
  7.   "blink_interval": "1s",
  8.  
  9.   // default: black
  10.   "cursor_color": "#00fd55"
  11.  
  12. }

配置参数:

typewriting() 该打字特效的第一个参数是你想要输出的文字。

第二个参数有下面的一些选项:

typing_interval:打字的速度

blink_interval:光标闪烁的速度

cursor_color:光标的颜色

第三个参数是打字效果完成之后的回调函数:

  1. $('.string').typewriting( "Text here", {
  2.     "typing_interval": 300,
  3.     "blink_interval": "1.5s"
  4.     "cursor_color": "white"
  5. }, function() {
  6.     console.log( "End." );
  7. });

rewrite():

这个方法可以在同一个元素重写不同的文字。

  1. $('.string').rewrite( "Another text here", function() {
  2.     console.log( "End, 2." );
  3. });

超逼真的控制台打字 jQuery 特效

已有 362 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!