mirror of
https://github.com/gdsmith/jquery.easing.git
synced 2026-06-09 15:37:03 +02:00
Merge pull request #13 from tacitknowledge/master
Add CommonJS and AMD support.
This commit is contained in:
@@ -2,4 +2,17 @@
|
||||
|
||||
What is it? A jQuery plugin from GSGD to give advanced easing options. More info [here](http://gsgd.co.uk/sandbox/jquery/easing)
|
||||
|
||||
For CDN please use CloudFlare [`http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js`](http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js) to help my host. Thank you.
|
||||
For CDN please use CloudFlare [`http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js`](http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js) to help my host. Thank you.
|
||||
|
||||
# AMD or CommonJS usage
|
||||
|
||||
```js
|
||||
// CommonJS
|
||||
var jQuery = require('jquery');
|
||||
require('jquery.easing')(jQuery);
|
||||
|
||||
// AMD
|
||||
define(['jquery', 'jquery.easing'], function (jQuery, easing) {
|
||||
easing(jQuery)
|
||||
})
|
||||
```
|
||||
|
||||
+12
-2
@@ -7,7 +7,17 @@
|
||||
*/
|
||||
|
||||
// t: current time, b: begInnIng value, c: change In value, d: duration
|
||||
(function($){$.easing['jswing'] = $.easing['swing'];
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(function () {
|
||||
return factory;
|
||||
});
|
||||
} else if (typeof module === "object" && typeof module.exports === "object") {
|
||||
exports = factory;
|
||||
} else {
|
||||
factory(jQuery);
|
||||
}
|
||||
})(function($){$.easing['jswing'] = $.easing['swing'];
|
||||
|
||||
$.extend( $.easing,
|
||||
{
|
||||
@@ -140,4 +150,4 @@ $.extend( $.easing,
|
||||
if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
||||
return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
||||
}
|
||||
});})(jQuery);
|
||||
});});
|
||||
|
||||
Reference in New Issue
Block a user