jQuery plugin for working with sprites of images.
Three quick start options are available:
- Clone the repo:
git clone https://github.com/nelsera/jSprite.git
npm start
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>
Here's a list of available settings. Example:
$(".animation").jSprite({
total: 65,
timeTransition: 30,
timeReload: 20
});
If true, animation is not started. Default false.
Set the initial position of the animation.
Set the end position of the animation.
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();
Back to position 1 and continue animation.
$animation.restart();
stop the animation.
$animation.stop();
Next position and continue animation.
$animation.next();
To stop after just call stop():
$animation.next().stop();
Previous position and continue animation.
$animation.prev();
To stop after just call stop():
$animation.prev().stop();
go to frame.
$animation.goTo(5);
This library relies on both Selection and execCommand APIs. The second one is supported in the following browsers.
42+ ✔ | 41+ ✔ | 9+ ✔ | 29+ ✔ | 7+ ✔ |
Check CONTRIBUTING.md
MIT License © Nelson Francisco