Giter VIP home page Giter VIP logo

jibjab's Introduction

jQuery JibJab

jQuery JibJab lets you reveal a string of text in a container, one character at the time.

Examples:

Usage

After including the jquery.jibjab.js javascript along with jQuery, you can call jibjab() on a DOM element:

$('#container').jibjab({text: 'This text will be revealed one character at the time' });

When calling jibjab() without the text option, JibJab utilises the elements innerHTML. Make sure you pass some text when calling jibjab() on an empty target element.

Options

The following options can be passed with initialization.

Option Type Default Description
speed integer 60 The speed in milliseconds at which characters should be revealed.
gasping boolean true Whether or not punctutation breathing space should be inserted. Currently comma's, multiple dots and EOL dots are supported.
commaDelay integer 200 Breathing space after a comma. Requires gasping to be true.
dotsDelay integer 140 Breathing space after multiple dots. Requires gasping to be true.
eolDelay integer 200 Breathing space after completing a line. Requires gasping to be true.

Pass options like this:

$('#container').jibjab({
  gasping: false,
  eolDelay: 600
});

Events

JibJab fires the following events.

Event Parameters Description
Progress event, progress Returns the progress on a 0-100 scale after revealing a character.
Finished none Fired when all characters have been revealed.

Subscribe to events like this:

$('#container').on('finish', function() {
  alert('JibJab has finished. So much fun!');
});

Specs

The specs are written with mocha. To run the specs:

  1. Install mocha
  2. run npm install from the project directory to install the dependencies
  3. run mocha --compilers coffee:coffee-script from the project directory, optionally passing --reporter nyan (:

Planned

  • HTML tag support
  • Sound effects
  • Computing word breaks within container

jibjab's People

Contributors

richardvenneman avatar

Stargazers

Carlos Santos 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.