<span id="typed"></span>
<div id="actions">
<button data-action="start">play</button>
<button data-action="stop">pause</button>
</div>
const typed = new Typed('#typed', {
typeSpeed: 100,
loop: true,
strings: [
'hello, world!!',
'fuck the world',
'fuck everything',
],
});
document.querySelector('#actions').addEventListener('click', e => {
const { action } = e.target.dataset;
if (action) {
typed[action]();
}
});
var typed = new Typed("#typed", {
strings: ['Welcome to...', 'Hello!.', 'How are you?'],
onStop: (arrayPos, self) => {
console.log('onStop', arrayPos, self);
},
onStart: (arrayPos, self) => {
console.log('onStart', arrayPos, self)
}
});
var checkbox = document.querySelector("input[id=typstop]");
checkbox.addEventListener( 'change', function() {
if(this.checked) {
// Checkbox is checked..
typed.stop();
} else {
// Checkbox is not checked..
typed.start();
}
});