Skip to content

Commit 9c3965b

Browse files
committed
Fixed chaining of scale() and rotate() by returning "this"
1 parent fc4796d commit 9c3965b

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

README

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This monkey patch for jQuery 1.3.1+ allows you to:
1414
$('#example').rotate('30deg');
1515
$('#example').scale(1.5);
1616
$('#example').rotate('45deg');
17+
$('#example').scale(1.5).rotate('45deg'); // chaining
1718
$('#example').rotate(); // returns '45deg'
1819
$('#example').scale(); // returns '1.5'
1920

@@ -48,5 +49,7 @@ under both MIT and GPL licenses, just like jQuery.
4849
Change Log
4950
-----------------------------
5051

52+
2010.11.06 - Fixed chaining of scale() and rotate() by returning "this"
53+
5154
2009.07.15 - Added to GitHub
5255

jquery-animate-css-rotate-scale.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
(function ($) {
22
// Monkey patch jQuery 1.3.1+ to add support for setting or animating CSS
33
// scale and rotation independently.
4-
// 2009 Zachary Johnson www.zachstronaut.com
4+
// 2009-2010 Zachary Johnson www.zachstronaut.com
5+
// Updated 2010.11.06
56
var rotateUnits = 'deg';
67

78
$.fn.rotate = function (val)
@@ -35,6 +36,8 @@
3536
style.replace(/none|rotate\([^)]*\)/, '') + 'rotate(' + m[1] + rotateUnits + ')'
3637
);
3738
}
39+
40+
return this;
3841
}
3942

4043
// Note that scale is unitless.
@@ -60,6 +63,8 @@
6063
'transform',
6164
style.replace(/none|scale\([^)]*\)/, '') + 'scale(' + val + ')'
6265
);
66+
67+
return this;
6368
}
6469

6570
// fx.cur() must be monkey patched because otherwise it would always
@@ -127,4 +132,4 @@
127132

128133
return animateProxied.apply(this, arguments);
129134
}
130-
})(jQuery);
135+
})(jQuery);

jquery-css-transform

Submodule jquery-css-transform updated 2 files

0 commit comments

Comments
 (0)