typed js code example
Example 1: typed.js
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
Example 2: typed js
yarn add typed.js
// or
npm install typed.js
// or
bower install typed.js
// in js file:
import Typed from 'typed.js';
const options = {
strings: ['<i>First</i> sentence.', '& a second sentence.'],
typeSpeed: 40
};
const typed = new Typed('.element', options);
Example 3: typedjs
// Can also be included with a regular script tag
import Typed from 'typed.js';
var options = {
strings: ['<i>First</i> sentence.', '& a second sentence.'],
typeSpeed: 40
};
var typed = new Typed('.element', options);
Example 4: typed js
var typed = new Typed("#typed", {
stringsElement: '#typed-strings',
typeSpeed: 0,
backSpeed: 0,
backDelay: 500,
startDelay: 1000,
loop: false,
onBegin: function(self) { prettyLog('onBegin ' + self) },
onComplete: function(self) { prettyLog('onCmplete ' + self) },
preStringTyped: function(pos, self) { prettyLog('preStringTyped ' + pos + ' ' + self); },
onStringTyped: function(pos, self) { prettyLog('onStringTyped ' + pos + ' ' + self) },
onLastStringBackspaced: function(self) { prettyLog('onLastStringBackspaced ' + self) },
onTypingPaused: function(pos, self) { prettyLog('onTypingPaused ' + pos + ' ' + self) },
onTypingResumed: function(pos, self) { prettyLog('onTypingResumed ' + pos + ' ' + self) },
onReset: function(self) { prettyLog('onReset ' + self) },
onStop: function(pos, self) { prettyLog('onStop ' + pos + ' ' + self) },
onStart: function(pos, self) { prettyLog('onStart ' + pos + ' ' + self) },
onDestroy: function(self) { prettyLog('onDestroy ' + self) }
});