8000 Support $.css({ scale: [2,2] }). · f2er/jquery.transit@decf3b7 · GitHub
[go: up one dir, main page]

Skip to content

Commit decf3b7

Browse files
committed
Support $.css({ scale: [2,2] }).
1 parent f56e204 commit decf3b7

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

jquery.transit.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@
127127
// // Same as set('scale', '2', '4');
128128
//
129129
setFromString: function(prop, val) {
130-
var args = (typeof val === 'string') ? val.split(',') : [val];
130+
var args =
131+
(typeof val === 'string') ? val.split(',') :
132+
(val.constructor == Array) ? val :
133+
[ val ];
134+
131135
args.unshift(prop);
132136

133137
Transform.prototype.set.apply(this, args);
@@ -228,14 +232,12 @@
228232

229233
scale: function() {
230234
var s = (this.scale || "1,1").split(',');
235+
if (s[0]) s[0] = parseFloat(s[0]);
236+
if (s[1]) s[1] = parseFloat(s[1]);
231237

232238
// "2.5,2.5" => 2.5
233-
if (parseFloat(s[0]) == parseFloat(s[1]))
234-
return parseFloat(s[0]);
235-
236-
// "2.5,1" => "2.5,1"
237-
else
238-
return s;
239+
// "2.5,1" => [2.5,1]
240+
return (s[0] == s[1]) ? s[0] : s;
239241
}
240242
},
241243

0 commit comments

Comments
 (0)
0