https://github.com/danielrs/typing.js
Simple and lightweight typing animations.
https://github.com/danielrs/typing.js
Last synced: 8 months ago
JSON representation
Simple and lightweight typing animations.
- Host: GitHub
- URL: https://github.com/danielrs/typing.js
- Owner: danielrs
- License: mit
- Created: 2015-11-16T15:03:54.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-11-23T00:18:10.000Z (over 7 years ago)
- Last Synced: 2025-03-16T02:08:11.969Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 115 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# typing.js
Simple and lightweight typing animations. Check the [stress-test demo](http://codepen.io/DanielRS/pen/jbjoZN)
### Installation
The plugin is available in bower:
`bower install typing.js`
### Usage
```javascript
Typing.new('p', {sentences: ['Lorem ipSOM do', 'Lorem ipsum dolor SIT amet', 'Lorem ipsum dolor sit amet'] [...]});
```
or with jQuery:
```javascript
...
$('p').typing({ sentences: ['Lorem ipSOM do', 'Lorem ipsum dolor SIT amet', 'Lorem ipsum dolor sit amet'] [...]});
...
```
### Options
| Option | Default | Description |
| ------ | ------- | ----------- |
| `sentences` | `['Hello typing.js']` | List of strings to render in the selected elements. |
| `caretChar` | `_` | String that will be used as the caret character. |
| `caretClass` | `typingjs__caret` | Class to be used for the caret character. Can be styled using CSS. |
| `ignoreContent` | `false` | If set to true, the current content in the selected elements will be cleared without typing animation. |
| `ignorePrefix` | `false` | Typing animation stops on the common prefix between current sentence and next sentence. If set to true, the animation will ignore the prefix and delete all characters before starting next sentence. |
| `typeDelay` | `50` | The delay in milliseconds between each typed character. |
| `sentenceDelay` | `750` | The delay in milliseconds between each sentence. |
| `humanize` | `true` | Adds noise to typeDelay, so the typing looks less robotic. |
| `onType` | `undefined` | Callback that is called each time a new character is entered. |
| `onBackspace` | `undefined` | Callback that is called each time a new character is deleted. |
| `onFinish` | `undefined` | Callback that is called when the plugin finished its job. |
| `onSentenceFinish` | `undefined` | Callback that is called each time a sentence is finished. |
## Any alternatives?
The goal of this library is to be as lightweight and simple as posible, for another similar projects check [typed.js](https://github.com/mattboldt/typed.js/)