nelsera / jSprite

jquery plugin for working with sprites of images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jSprite

jQuery plugin for working with sprites of images.

Getting started

Three quick start options are available:

  • Clone the repo: git clone https://github.com/nelsera/jSprite.git

npm start

Usage

Include jQuery:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

Include plugin JS:

<script src="jquery.jSprite.js"></script>

Options

Here's a list of available settings. Example:

$(".animation").jSprite({
    total: 65,
    timeTransition: 30,
    timeReload: 20
});

wait

If true, animation is not started. Default false.

from

Set the initial position of the animation.

to

Set the end position of the animation.

Methods

Get access to the methods by creating a var and calling $.data():

$('selector').jSprite();
var $animation = $('selector').data('plugin_jSprite');

And now we can call jSprite methods:

$animation.restart();

List of Methods

restart

Back to position 1 and continue animation.

$animation.restart();

stop

stop the animation.

$animation.stop();

next

Next position and continue animation.

$animation.next();

To stop after just call stop():

$animation.next().stop();

prev

Previous position and continue animation.

$animation.prev();

To stop after just call stop():

$animation.prev().stop();

goTo(integer)

go to frame.

$animation.goTo(5);

Browser Support

This library relies on both Selection and execCommand APIs. The second one is supported in the following browsers.

Chrome logo Firefox logo Internet Explorer logo Opera logo Safari logo
42+ ✔ 41+ ✔ 9+ ✔ 29+ ✔ 7+ ✔

Contributing

Check CONTRIBUTING.md

License

MIT License © Nelson Francisco

About

jquery plugin for working with sprites of images


Languages

Language:JavaScript 86.3%Language:HTML 9.4%Language:CSS 4.3%