User:Sowminya Arikapudi/common.js: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) No edit summary |
Matt Pijoan (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
$.fn.animateRotate = function (angle, duration, complete) { | $.fn.animateRotate = function (angle, duration, complete) { | ||
Line 22: | Line 19: | ||
}); | }); | ||
}; | }; | ||
$('#content').animateRotate(360, 5000, function () { | |||
alert('A shield you say?'); | |||
}); |
Revision as of 20:44, 22 September 2015
$.fn.animateRotate = function (angle, duration, complete) { return this.each(function () { var $elem = $(this); $({ deg : 0 }).animate({ deg : angle }, { duration : duration, step : function (now) { $elem.css({ transform : 'rotate(' + now + 'deg)' }); }, complete : complete || $.noop }); }); }; $('#content').animateRotate(360, 5000, function () { alert('A shield you say?'); });