j-Typed
- Based on typed.js by Matt Boldt
- Value must be array
Configuration:
Config is the same as typed.js. The only difference is that all keys are lowercase. This is to maintain consistency with other components. The only added configuration is id
- NEW:
selector {String}can contain a nested element for rendering text - NEW:
text {String}in the formText 1|Text 2|Text 3|Text Notherwise text is loaded according to thepath typespeed {Number}in milliseconds (default:0)startdelay {Number}in milliseconds (default:0)backspeed {Number}in milliseconds (default:0)smartbackspace {Boolean}this would only backspace the words after "This is a" (default:true)shuffle {Boolean}shuffle the strings (default:true)backdelay {String}time before backspacing (default:700)fadeout {Boolean}fade out instead of backspace (default:false)fadeoutclass {String}css class for fade animation (default:typed-fade-out)fadeoutdelay {Number}fade out delay in milliseconds (default:500)loop {Boolean}loop strings (default:false)loopcount {String/Number}amount of loops (default:Infinity)showcursor {Boolean}show cursor (default:true)cursorchar {String}cursor character (default:|)autoinsertcss {Boolean}insert CSS for cursor and fadeOut into HTML<head>(default:true)contenttype {String}contentTypehtmlornullfor plaintext (default:html)
Global events:
Again, same as typed.js. Added component parameter
ON('typed.onComplete', function(typed, component) {})ON('typed.preStringTyped', function(pos, typed, component) {})ON('typed.onStringTyped', function(pos, typed, component) {})ON('typed.onLastStringBackspaced', function(typed, component) {})ON('typed.onTypingPaused', function(pos, typed, component) {})ON('typed.onTypingResumed', function(pos, typed, component) {})ON('typed.onReset', function(typed, component) {})ON('typed.onStop', function(pos, typed, component) {})ON('typed.onStart', function(pos, typed, component) {})ON('typed.onDestroy', function(typed, component) {})
Use it with <ui-component name="typed">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Denis Granec. Source: the Componentator components repository, MIT license.
<div style="height:100px">
<ui-component name="typed" path="messages" config="loop:true" style="white-space:pre"></ui-component>
</div>
<div style="height:50px">
<ui-component name="typed" path="messages2" config="loop:true;typespeed:100;backspeed:50"></ui-component>
</div>
<script>
var messages = 'npm install total.js^1000\n`+ <b>total.js@3.1.0</b>` ^1000\n`added <b>1 package</b> from 23 contributors and audited 1 package in <b>1.348s</b>` ^1000\n`found 0 vulnerabilities`';
var messages2 = ['Hello world!', '<b>Total.js</b> is awesome!', 'jComponent is <b>awesome</b>!', 'Lorem ipsum', 'Lorem dolor'];
var count = 0;
ON('typed.onComplete', function(typed, component) {
if (typed.el.id === 'myconsole') {
count++;
if (count === 5)
typed.loop = false;
}
});
</script>