Giter Club home page Giter Club logo

jquery-typewrite's Introduction

jquery-typewrite

Type the content of an HTML element, character by character

Why?

There's a few plugins out there allowing you to type some text character by character, however I haven't been able to find one which would allow my to type HTML elements along with the text. You can even nest the HTML elements inside and it will still work.

How?

It replaces all the HTML tags inside the element with a placeholder character. When finding this character whilst typing the text, it will insert the element and call .typewrite() on it recursively and wait until the context of the element is typed out to continue typing the rest of the text.

Usage

Install using bower: bower install jquery-typewrite
Or using npm: npm install jquery-typewrite
Or just by downloading the tarball

The .typewrite() function allows a callback which will be called once all the text has been typed.

	$("#my-novel").typewrite();

	$("#my-short-story").typewrite(function() { console.log('done'); });	

There is also a .stopTypewrite() which will render all the content immediately and call the callback if one has been set.

	$("#my-novel").stopTypewrite();

Options

options.delay

Type: Integer
Default: 60

The amount of time, in milliseconds, between each character.

options.placeholder

Type: String
Default:

The character used for replacing HTML tags. If you wish to use the default character in your text, you can choose your own by setting this option.
If you set this option don't forget to set it too if you call .stopTypewrite().

	$("#my-novel").typewrite({ delay: 180 }, function () {
		console.log("All the text has been typed");
	});

Changelog

  • 0.1.0 - First release

jquery-typewrite's People

Contributors

mathieuloutre avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.