block-reveal.js
2 months ago
blur-in.js
1 month ago
bounce-in.js
1 month ago
drop-in.js
1 month ago
fade-in.js
1 month ago
flash.js
1 month ago
flicker.js
1 month ago
flip-in.js
1 month ago
glitch-rgb.js
1 month ago
glitch.js
1 month ago
glow-in.js
1 month ago
pulse-neon.js
1 month ago
pulse.js
1 month ago
random-reveal.js
1 month ago
roll-in.js
1 month ago
rotate-in.js
1 month ago
rubber-band.js
1 month ago
scale-in.js
1 month ago
shadow-pop.js
1 month ago
shuffle-text.js
1 month ago
slide-down.js
1 month ago
slide-left.js
1 month ago
slide-right.js
1 month ago
slide-up.js
1 month ago
solid-outline.js
1 month ago
squeeze.js
1 month ago
stretch.js
1 month ago
swing.js
1 month ago
terminal-type.js
1 month ago
tracking-expand.js
1 month ago
typewriter.js
1 month ago
water-drop.js
1 month ago
wave.js
1 month ago
typewriter.js
33 lines
| 1 | ( function () { |
| 2 | 'use strict'; |
| 3 | |
| 4 | var CHAR_INTERVAL = 80; |
| 5 | |
| 6 | function play( el ) { |
| 7 | var text = el.getAttribute( 'data-original-text' ) || el.textContent; |
| 8 | el.setAttribute( 'data-original-text', text ); |
| 9 | el.innerHTML = ''; |
| 10 | |
| 11 | var chars = text.split( '' ); |
| 12 | var i = 0; |
| 13 | |
| 14 | function type() { |
| 15 | if ( i < chars.length ) { |
| 16 | var span = document.createElement( 'span' ); |
| 17 | span.className = 'frbl-char'; |
| 18 | span.textContent = chars[ i ]; |
| 19 | el.appendChild( span ); |
| 20 | i++; |
| 21 | setTimeout( type, CHAR_INTERVAL ); |
| 22 | } else { |
| 23 | el._frblLoop && setTimeout( function () { play( el ); }, 2500 ); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | type(); |
| 28 | } |
| 29 | |
| 30 | window.FrblAnimations = window.FrblAnimations || {}; |
| 31 | window.FrblAnimations['typewriter'] = play; |
| 32 | } )(); |
| 33 |