Pure JavaScript plugin for animating placeholders on input elements
- Include the typewriter.js script into your file before the tag.
- Call the typewriter with the
new Typewriter
constructor function - Enjoy
Calling a new instance of the typewriter:
new TypeWriter('#zipcodeInput', ['Input Your Zip Code', 'eg. 93108'], {writeDelay: 200});
The new TypeWriter
accepts three arguments
- A querySelector to select the input field
- An array of strings to be typed out in the selected input field
- An options settings object to overwrite default settings
- writeDelay => Delay between each letter is written (default: 60ms)
--expecting a number of miliseconds - deleteDelay => Delay between each letter is removed (default: 40ms)
--expecting a number of miliseconds - holdOnceWritten => Delay once the current phrase has been fully displayed (default: 1000ms)
--expecting a number of miliseconds - holdOnceDeleted => Delay once the current phrase has been fully deleted (default: 1000ms)
--expecting a number of miliseconds - stopAfterOnce => Runs through the phrases only once, then leaves the first phrase as a static placeholder
--expecting a boolean