This time I will share jQuery Plugin and tutorial about Simulating Typing, Deleting And Selecting Text With jQuery – typewrite, hope it will help you in programming stack.
typewrite is a tiny jQuery typing animation plugin which allows to simulate someone typing, deleting and selecting given words defined in the JavaScript.
Basic usage:
1. Add the JavaScript file typewrite.js
to the webpage, after you’ve loaded jQuery library.
1 |
< script src = "//code.jquery.com/jquery.min.js" ></ script > |
2 |
< script src = "src/typewrite.js" ></ script > |
2. Create an empty DIV container in which your want to print the text.
1 |
< div id = "typewriteText" ></ div > |
3. Attach the plugin to the container element and define type/remove/select/delay actions and text as JS objects to the actions
array as follows:
01 |
$('#typewriteText').typewrite({ |
07 |
{remove: {num: 1, type: 'stepped'}}, |
08 |
{select: {from: 11, to: 16}}, |
10 |
{remove: {num: 5, type: 'whole'}}, |
12 |
{type: 'lcome to typewrite . '}, |
14 |
{type: 'It's so easy to setup and use.'} |
4. Default settings for the typing animation.
01 |
$( '#typewriteText' ).typewrite({ |
19 |
selectedBackground: '#F1F1F1' , |
22 |
selectedText: '#333333' |
5. Events.
02 |
.on( 'typewriteStarted' , function () { |
05 |
.on( 'typewriteComplete' , function () { |
08 |
.on( 'typewriteTyped' , function (event, data) { |
11 |
.on('typewriteRemoved ', function(event, data) { |
12 |
// typewrite has removed' , data); |
14 |
.on( 'typewriteNewLine' , function () { |
17 |
.on( 'typewriteSelected' , function (event, data) { |
20 |
.on('typewriteDelayEnded', function () { |
This awesome jQuery plugin is developed by mrvautin. For more Advanced Usages, please check the demo page or visit the official website.