DESCRIPTION
AutoTyping.js is a lightweight (1.86 kb) and easy to use library that writes and deletes text.
GETTING STARTED
dist/autotyping.js
const typing = new AutoTyping('selector', [array of words]);
e.g.
const typing = new AutoTyping('.my-selector', ['lorem ipsum etc', 'after the first text']);
typing.start();
OPTIONS
[
'first text',
'second text',
'etc...'
]
This is where you write the text that will be written and deleted by the library.
Controls the writing speed of each character.
Controls how fast/slow each character is deleted.
Controls how much time the library will wait before deleting a word.
Controls how much time the library will wait before writing the next word.
Controls if the text should be written all together (word per word and not character by character).
EXAMPLES
<p>This is an example: <span class="example-selector"></span></p>
Javascript:
<script src="dist/autotyping.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
const exampleText = ['I can write a whole sentence.', 'Or', 'single', 'words'];
const exampleTyping = new AutoTyping('.example-selector', exampleText, {
typeSpeed: 50,
deleteSpeed: 50,
waitBeforeDelete: 2000,
waitBetweenWords: 500,
});
exampleTyping.start()
});
</script>
This is the live example of the above code:
This is an example: