Javascript Module of jQuery extensions, example: animateRotate
/* --------- Start jquery.extensions.module.js --------- */
// jquery extensions Module
(function ( $ ) {
$.fn.animateRotate = function(angle, duration, easing, complete) {
var args = $.speed(duration, easing, complete);
var step = args.step;
return $(this).each(function(i, e) {
args.complete = $.proxy(args.complete, e);
args.step = function(now) {
$.style(e, 'transform', 'rotate(' + now + 'deg)');
if (step) return step.apply(e, arguments);
};
$({deg: 0}).animate({deg: angle}, args);
});
}
// method/extension #2 goes here, and so on...
})( window.jQuery );
/* --------- End jquery.extensions.module.js --------- */
This entry was posted on Wednesday, November 25th, 2015 at 11:11 am and is filed under JavaScript, jQuery. You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.