Skip to content
Browse files

ironed out all of the IE bugs. IE now transforms exactly as Moz, incl…

…uding respecting transform-origin.
  • Loading branch information...
1 parent d8ebb2b commit 4cd7bf2386572b4a66d0dff816ca0cfecb4fdf4a unknown committed May 16, 2010
Showing with 198 additions and 182 deletions.
  1. +22 −14 animate.html
  2. +13 −3 css/transform.css
  3. +163 −165 lib/transform.js
View
36 animate.html
@@ -34,6 +34,7 @@
</aside>
<section class="main">
<div class="line">
+ <ul id="ie-barf"></ul>
<div class="unit size1of2">
<form id="transform" name="transform" action="">
<div class="line">
@@ -127,21 +128,28 @@
<script src="lib/sylvester-0.1.3.min.js"></script>
<script src="lib/transform.js"></script>
<script type="text/javascript">
- var thing = $('.transform').transform();
+ $('#target2').transform({origin: [0, 0]});
+ var thing = $('.transform');
+ var i = 0;
thing.click(function() {
- $(this).animate({
- skew: '+=180deg +=180', //you don't have to use units
- skewX: '+=5',
- skewY: '+=5',
- rotate: '+=360deg',
- scale: '+=.1 +=.1',
- scaleX: '+=.05',
- scaleY: '+=.05',
- translate: '+=10px -=10px',
- translateX: '-=1',
- translateY: '-=1'
- }, 1500);
- }).mouseenter(shake);
+ var $el = $(this);
+ $el.animate({rotate: '+=11.25deg'});
+ });
+
+ $(document).keydown(function(e) {
+ var prop = {};
+ var pos = thing.position();
+ switch (e.which) {
+ case 40: prop.top = (pos.top + 1) + 'px';break;
+ case 38: prop.top = (pos.top - 1) + 'px';break;
+ case 39: prop.left = (pos.left + 1) + 'px';break;
+ case 37: prop.left = (pos.left - 1) + 'px';break;
+ }
+ if (!$.isEmptyObject(prop)) {
+ e.preventDefault();
+ thing.css(prop);
+ }
+ });
function shake() {
var thing = $(this);
View
16 css/transform.css
@@ -2,6 +2,16 @@ textarea {
width: 100%;
height: 10em;
}
+section table th,
+section table td {
+ padding: 3px;
+ border-left: none;
+ border-right: none;
+}
+.right-col {
+ background-repeat: no-repeat;
+ background-position: 23px 58px;
+}
.holder {
position: relative;
overflow: visible;
@@ -21,8 +31,8 @@ textarea {
}
.transform-ie {
- -moz-transform-origin: top left;
+ /*-moz-transform-origin: top left;
-webkit-transform-origin: top left;
- -o-transform-origin: top left;
- position: absolute;
+ -o-transform-origin: top left;*/
+ position: relative;
}
View
328 lib/transform.js
@@ -1,4 +1,4 @@
-(function($) {
+(function($, window, document, undefined) {
/**
* Converting a radian to a degree
* @const
@@ -37,6 +37,11 @@
var rfxmultinum = /^(.*?)\s+([+\-]=)?([\d+.\-]+)(.*)$/;
/**
+ * @var Regex identify the matrix filter in IE
+ */
+ var rmatrix = /progid:DXImageTransform\.Microsoft\.Matrix\(.*?\)/;
+
+ /**
* @var Array list of all valid transform functions
*/
var transformFuncs = ['rotate', 'scale', 'scaleX', 'scaleY', 'skew', 'skewX', 'skewY', 'translate', 'translateX', 'translateY'];
@@ -50,18 +55,28 @@
* The element we're working with
* @var jQueryCollection
*/
- this.element = $(element);
+ this.$elem = $(element);
/**
* Remember the transform property so we don't have to keep looking it up
* @var string
*/
this.transformProperty = this._getTransformProperty();
- // fix the attributes for the thingy
- //TODO: this should be done before an animation is run
- //TODO: this should be part of the set attributes thing
- //this.setAttributes({});
+
+ //IE mangles the height and width, let's try to preserve them
+ //NOTE: if someone was rude enough to transform it in IE with CSS then we're kind of screwed
+ //NOTE: if someone is rude enough to alter the height or width then we're also screwed
+ if (!this.transformProperty && !this.$elem.data('dims')) {
+ this.$elem.data('dims', {
+ height: this.$elem.height(),
+ width: this.$elem.width(),
+ outerHeight: this.$elem.outerHeight(),
+ outerWidth: this.$elem.outerWidth(),
+ innerHeight: this.$elem.innerHeight(),
+ innerWidth: this.$elem.innerWidth()
+ });
+ }
},
p = o.prototype;
@@ -91,7 +106,7 @@
var _animate = $.fn.animate;
$.fn.animate = function( prop, speed, easing, callback ) {
if (prop && !jQuery.isEmptyObject(prop)) {
- var element = this[0];
+ var elem = this[0];
jQuery.each( prop, function( name, val ) {
// Clean up the numbers for space-sperated prop values
if ($.inArray(transformFuncs, name)) {
@@ -123,7 +138,7 @@
}
// Save the values and truncate the property
- element['data-animate-' + name] = values;
+ elem['data-animate-' + name] = values;
prop[name] = values[0].end;
}
}
@@ -163,7 +178,7 @@
$.fx.multivalueInit = function(fx) {
var parts,
unit = fx.unit,
- values = fx.transform.getAttribute(fx.prop, true),
+ values = fx.transform.getAttr(fx.prop, true),
initValues = fx.elem['data-animate-' + fx.prop];
fx.values = [];
@@ -211,15 +226,19 @@
}
};
- $.each(transformFuncs, function(i, attr) {
- $.fx.step[attr] = function(fx) {
+ /**
+ * Step for animating tranformations
+ */
+ $.each(transformFuncs, function(i, func) {
+ $.fx.step[func] = function(fx) {
// Initialize the transformation
if (!fx.transformInit) {
fx.transform = new Transform(fx.elem);
// Correct for start being NaN
+ // TODO: this probaly isn't needed anymore
if (isNaN(fx.start)) {
- fx.start = fx.transform.getAttribute(fx.prop, true);
+ fx.start = fx.transform.getAttr(fx.prop, true);
if ($.isArray(fx.start)) {
fx.start = fx.start[0];
}
@@ -244,7 +263,7 @@
fx.transformInit = true;
- // if start and end are the same that skip this whole mess
+ // if start and end are the same then skip this whole mess
if (fx.start == fx.end) {
return fx.step(true);
}
@@ -293,74 +312,76 @@
p.transform = function(funcs, options) {
// determine if the CSS property is known
var property = this.transformProperty;
-
+
// extend options
options = $.extend(true, {
forceMatrix: false,
preserve: false
}, options);
// preserve the funcs from the previous run
- var prevFuncs = this.getAttributes(true, true);
- if (options.preserve && prevFuncs) {
- funcs = $.extend(true, prevFuncs, funcs);
+ if (options.preserve) {
+ funcs = $.extend(true, this.getAttrs(true, true), funcs);
} else {
funcs = $.extend(true, {}, funcs); // copy the object to prevent weirdness
}
- // remember the funcs
-
// Record the custom attributes on the element itself (helps out the animator)
- this.setAttributes(funcs);
+ this.clearAttrs();
+ this.setAttrs(funcs);
// apply the funcs
if (property && !options.forceMatrix) {
// CSS3 is supported
- return this.applyFunctions(funcs);
+ return this.applyFuncs(funcs);
} else if ($.browser.msie || (property && options.forceMatrix)) {
// Internet Explorer or Forced matrix
return this.applyMatrix(funcs);
}
return false;
}
+ p.clearAttrs = function() {
+ $.each(transformFuncs, $.proxy(function (i, func) {
+ if (this.$elem[0][func] !== undefined) {
+ this.$elem[0][func] = undefined;
+ }
+ }, this));
+ }
+
/**
* @param Object funcs a list of transform functions to store on this element
* @return void
*/
- p.setAttributes = function(funcs) {
- //TODO: this doesn't seem right
- $.each(transformFuncs, $.proxy(function (i, func) {
- var value = funcs[func] || null;
- this.setAttribute(func, value);
- }, this));
+ p.setAttrs = function(funcs) {
+ $.each(funcs, $.proxy(this.setAttr, this));
}
/**
* @param string func name of a transform function
* @param mixed value with proper units
* @return void
*/
- p.setAttribute = function(func, value) {
+ p.setAttr = function(func, value) {
if ($.isArray(value)) {
$.each(value, function(i){value[i] = parseFloat(value[i]);});
value = value.join(' ');
- } else if (value !== null && value != undefined) {
+ } else if (value || value === 0) {
value = parseFloat(value);
}
- this.element[0][func] = value; //should be unitless
+ this.$elem[0][func] = value; //should be unitless
}
/**
* @param Bool split splits space separated values into an array
* @param Bool withUnits
* @return Object values with proper units
*/
- p.getAttributes = function(split, withUnits) {
+ p.getAttrs = function(split, withUnits) {
var attrs = {}, value;
- $.each(transformFuncs, $.proxy(function (i, func, split) {
- value = this.getAttribute(func, split, withUnits, true);
- if (value !== null && value !== undefined) {
+ $.each(transformFuncs, $.proxy(function (i, func) {
+ value = this.getAttr(func, split, withUnits, true);
+ if (value || value === 0) {
attrs[func] = value;
}
}, this));
@@ -373,8 +394,8 @@
* @param Bool withUnits
* @return value with proper units
*/
- p.getAttribute = function(func, split, withUnits, preserveNull) {
- var value = this.element[0][func];
+ p.getAttr = function(func, split, withUnits, preserveNull) {
+ var value = this.$elem[0][func];
if (preserveNull && !value && value !== 0){
return value;
} else if (unitless.test(func) && !value && value !== 0) {
@@ -401,54 +422,25 @@
}
/**
- * returns the CSS needed to recreate this transformation
- * TODO: remove this function.
- */
- p.generateCSS = function(options) {
- var opts = $.extend(true, {}, options); // default options
- var funcs = this.applyFunctions(opts, true);
- var matrix = this.applyMatrix(opts, true);
-
- var css =
- ".transform {\r\n" +
- "\ttransform: " + funcs + ";\r\n" +
- "\t-moz-transform: " + funcs + ";\r\n" +
- "\t-webkit-transform: " + funcs + ";\r\n" +
- "\t-o-transform: " + funcs + ";\r\n" +
- "\tposition: " + matrix.position + "\\9;\r\n" +
- "\ttop: " + matrix.top + "\\9;\r\n" +
- "\tleft: " + matrix.left + "\\9;\r\n" +
- "\tfilter: " + matrix.filter + ";\r\n" +
- "\t-ms-filter: " + matrix['-ms-filter'] + ";\r\n" +
- "}";
- return css;
- };
-
- /**
* Applies all of the transformations as functions
- * var Object options
+ * var Object funcs
*/
- p.applyFunctions = function(options, generate) {
+ p.applyFuncs = function(funcs, generate) {
var value = '';
var property = this.transformProperty;
// construct a CSS string
- for (var option in options) {
- if (this[option] && option == 'origin') {
- this[option].apply(this, $.isArray(options[option]) ? options[option] : [options[option]]);
- continue;
- }
- if (this[option]) {
- value += ' ' + _createTransformFunction(option, options[option]);
+ for (var func in funcs) {
+ // handle origin separately
+ if (func == 'origin') {
+ this[func].apply(this, $.isArray(funcs[func]) ? funcs[func] : [funcs[func]]);
+ } else if (this[func]) {
+ value += ' ' + _createTransformFunction(func, funcs[func]);
}
}
- // add the CSS
- if (generate) {
- return value;
- }
- this.element.css(property, value);
- this.element.data('transformed', true);
+ this.$elem.css(property, value);
+ this.$elem.data('transformed', true);
return true;
}
@@ -465,19 +457,25 @@
for (var option in options) {
if (this[option]) {
args = $.isArray(options[option]) ? options[option] : [options[option]];
+
+ // strip the units
$.each(args, function(i, arg) {
args[i] = parseFloat(arg);
});
if (option == 'origin') {
this[option].apply(this, args);
- continue;
+ } else {
+ matrices.push(this[option].apply(this, args));
}
- matrices.push(this[option].apply(this, args));
}
}
// calculate the final matrix
+ if (!matrices.length) {
+ return;
+ }
var matrix = this.matrix(matrices);
+
// pull out the relevant values
var a = parseFloat(parseFloat(matrix.e(1,1)).toFixed(8)),
b = parseFloat(parseFloat(matrix.e(2,1)).toFixed(8)),
@@ -490,63 +488,55 @@
if (property && property.substr(0, 4) == '-moz' && !generate) { // -moz
// @see https://developer.mozilla.org/En/CSS/-moz-transform#matrix
// matrix(a, c, b, d, tx, ty)
- this.element.css(property, 'matrix(' + a + ', ' + b + ', ' + c + ', ' + d + ', ' + tx + 'px, ' + ty + 'px)');
+ _calculateCorners(this.$elem, matrix);
+ this.$elem.css(property, 'matrix(' + a + ', ' + b + ', ' + c + ', ' + d + ', ' + tx + 'px, ' + ty + 'px)');
} else if (property && !generate) { // -webkit, -o, w3c
// @see http://www.w3.org/TR/SVG/coords.html#TransformMatrixDefined
// matrix(m11, m12, m21, m22, tX, tY)
// NOTE: WebKit and Opera don't allow units on the translate variables
- this.element.css(property, 'matrix(' + a + ', ' + b + ', ' + c + ', ' + d + ', ' + tx + ', ' + ty + ')');
+ this.$elem.css(property, 'matrix(' + a + ', ' + b + ', ' + c + ', ' + d + ', ' + tx + ', ' + ty + ')');
} else if (jQuery.browser.msie || generate) { // IE
// IE does not allow the transform origin to be set directly
var origin = { // all browsers default to 50%/50%
- x: parseFloat(_convertWidthToPx(this.element[0], '50%', true)),
- y: parseFloat(_convertHeightToPx(this.element[0], '50%', true))
+ x: parseFloat(_convertWidthToPx(this.$elem[0], '50%')),
+ y: parseFloat(_convertHeightToPx(this.$elem[0], '50%'))
}
- var transformOrigin = this.element.data('transformOrigin');
+
+ var transformOrigin = this.$elem.data('transformOrigin');
if (transformOrigin && typeof(transformOrigin.x) !== 'undefined') {
origin.x = parseFloat(transformOrigin.x);
}
if (transformOrigin && typeof(transformOrigin.y) !== 'undefined') {
origin.y = parseFloat(transformOrigin.y);
}
- var offset = _calculateOriginOffset(matrix, origin);
+ var offset = _calculateOriginOffset(this.$elem, matrix, origin);
- // IE glues the top and left of the transformed object to top/left of the original object
- var dims = _calculateDims(this.element, matrix, true);
+ // IE glues the top-most and left-most pixels of the transformed object to top/left of the original object
+ var dims = _calculateDims(this.$elem, matrix, true);
- // IE requires the special transform Filter
- var filter = 'progid:DXImageTransform.Microsoft.Matrix(M11=' + a + ', M12=' + c + ', M21=' + b + ', M22=' + d + ', sizingMethod=\'auto expand\')';
-
// Protect against an item that is already positioned
- var cssPosition = this.element.css('position');
- var pos = {top: 0, left: 0};
- if (cssPosition != 'static') {
-// if (!this.element.data('transformed')) {
-// pos = this.element.position();
-// } else {
-// pos = this.element.data('transformOriginalPosition');
-// }
- } else {
+ var cssPosition = this.$elem.css('position');
+ if (cssPosition == 'static') {
cssPosition = 'relative';
}
-// if (!this.element.data('transformed')) {
-// this.element.data('transformOriginalPosition', $.extend({}, pos));
-// }
-
+ //TODO: if the element is already positioned, we should attempt to respect it
+ var pos = {top: 0, left: 0};
+
+ // IE requires the special transform Filter
+ var style = this.$elem[0].style;
+ var matrixFilter = 'progid:DXImageTransform.Microsoft.Matrix(M11=' + a + ', M12=' + c + ', M21=' + b + ', M22=' + d + ', sizingMethod=\'auto expand\')';
+ var filter = style.filter || jQuery.curCSS( this.$elem[0], "filter" ) || "";
+ style.filter = rmatrix.test(filter) ? filter.replace(rmatrix, matrixFilter) : filter ? filter + ' ' + matrixFilter : matrixFilter;
+
+ // Approximates transform-origin, tx, and ty
var css = {
'position': cssPosition,
'top': (offset.top + ty + dims.top + pos.top) + 'px',
- 'left': (offset.left + tx + dims.left + pos.left) + 'px',
- 'filter': filter, // IE6, IE7
- '-ms-filter': filter // IE8+
+ 'left': (offset.left + tx + dims.left + pos.left) + 'px'
};
- // Apply the CSS
- if (generate) {
- return css;
- }
- this.element.css(css);
+ this.$elem.css(css);
}
- this.element.data('transformed', true);
+ this.$elem.data('transformed', true);
return true;
}
@@ -571,25 +561,25 @@
}
// convert all length units to px
- x = _convertWidthToPx(this.element[0], x);
+ x = _convertWidthToPx(this.$elem[0], x);
if (typeof(y) !== 'undefined') {
- y = _convertHeightToPx(this.element[0], y);
+ y = _convertHeightToPx(this.$elem[0], y);
}
// Apply the property
if (property) { //Moz, WebKit, Opera
if (!y) {
- this.element.css(property + '-origin', x);
+ this.$elem.css(property + '-origin', x);
} else {
- this.element.css(property + '-origin', x + ' ' + y);
+ this.$elem.css(property + '-origin', x + ' ' + y);
}
}
// remember the transform origin in an easy place (IE needs this)
if (!y) {
- this.element.data('transformOrigin', {x: x});
+ this.$elem.data('transformOrigin', {x: x});
} else {
- this.element.data('transformOrigin', {x: x, y: y});
+ this.$elem.data('transformOrigin', {x: x, y: y});
}
return true;
}
@@ -762,14 +752,14 @@
/**
* try to determine which browser we're in by the existence of a custom transform property
- * @param DOMElement el
+ * @param void
* @return String
*/
p._getTransformProperty = function() {
if (this.transformProperty) {
return this.transformProperty;
}
- var el = this.element[0];
+ var elem = this.$elem[0];
var transformProperty;
var property = {
transform : 'transform',
@@ -778,7 +768,7 @@
OTransform : '-o-transform'
}
for (var p in property) {
- if (typeof el.style[p] != 'undefined') {
+ if (typeof elem.style[p] != 'undefined') {
transformProperty = property[p];
return transformProperty;
}
@@ -848,14 +838,14 @@
* @param boolean outer
* @return Object
*/
- function _calculateCorners(el, matrix, outer) {
+ function _calculateCorners($elem, matrix, outer) {
// get the original coords
if (outer) {
- var y = el.outerHeight(),
- x = el.outerWidth();
+ var y = $elem.data('dims').outerHeight || $elem.outerHeight(),
+ x = $elem.data('dims').outerWidth || $elem.outerWidth();
} else {
- var y = el.height(),
- x = el.width();
+ var y = $elem.data('dims').height || $elem.height(),
+ x = $elem.data('dims').width || $elem.width();
}
// create corners for the original element
@@ -893,11 +883,10 @@
* @param boolean outer
* @return Object
*/
- function _calculateDims(el, matrix, outer) {
- //TODO: This actually calculates the offsets from the original positions
+ function _calculateDims($elem, matrix, outer) {
//NOTE: Are these called sides? This should probably be calculateSides
// the corners of the box
- var corners = _calculateCorners(el, matrix, outer);
+ var corners = _calculateCorners($elem, matrix, outer);
// create empty dimensions
var dims = {
@@ -913,7 +902,7 @@
var corner = corners[pos];
var x = corner.x,
y = corner.y;
-
+
// record the extreme corners
if (y < dims.top) {
dims.top = y;
@@ -938,8 +927,8 @@
* @param Matrix matrix
* @return Object
*/
- function _calculateSize(el, matrix){
- var dims = _calculateDims(el, matrix);
+ function _calculateSize($elem, matrix){
+ var dims = _calculateDims($elem, matrix);
// return size
return {
@@ -955,16 +944,14 @@
* @param Object fromOrigin
* @return Object
*/
- function _calculateOriginOffset(matrix, toOrigin, fromOrigin) {
+ function _calculateOriginOffset($elem, matrix, toOrigin, fromOrigin) {
// the origin to translate to
- //TODO: This default is 50px when it should be 50%
- //NOTE: The other calc functions require the element as the first arg, we could easily do a percentage with that info
toOrigin = toOrigin ? toOrigin : {
- x: 50,
- y: 50
+ x: parseFloat(_convertWidthToPx($elem[0], '50%')),
+ y: parseFloat(_convertHeightToPx($elem[0], '50%'))
};
- // the origin to translate from
+ // the origin to translate from (IE has a fixed origin of 0, 0)
fromOrigin = fromOrigin ? fromOrigin : {
x: 0,
y: 0
@@ -1005,17 +992,17 @@
* @param string length with attached units
* @param boolean inside measure inside the element instead of outside
*/
- function _convertWidthToPx(el, length, inside) {
- return _convertLengthToPx(el, length, inside, 'x');
+ function _convertWidthToPx(elem, length, inside) {
+ return _convertLengthToPx(elem, length, inside, 'x');
}
/**
* @param DOMElement el
* @param string length with attached units
* @param boolean inside measure inside the element instead of outside
*/
- function _convertHeightToPx(el, length, inside) {
- return _convertLengthToPx(el, length, inside, 'y');
+ function _convertHeightToPx(elem, length, inside) {
+ return _convertLengthToPx(elem, length, inside, 'y');
}
/**
@@ -1026,74 +1013,85 @@
* @param boolean inside measure inside the element instead of outside
* @param string axis
*/
- function _convertLengthToPx(el, length, inside, axis) {
+ function _convertLengthToPx(elem, length, inside, axis) {
+ $elem = $(elem);
// make sure we've provided a unit
if (rnumUnitless.test(length)) {
return length + 'px';
}
// percentages are easy
if (rnumPercent.test(length)) {
+ var dims = $elem.data('dims');
switch (axis) {
- case 'y' : break;
- var height = inside ? $(el).innerHeight(): $(el).outerHeight();
- return height * (parseFloat(length)/100) + 'px';
+ case 'y' :
+ if (dims) {
+ var len = inside ? dims.height : dims.outerHeight;
+ } else {
+ var len = inside ? $elem.height() : $elem.outerHeight();
+ }
+ break;
case 'x' : //no break
default:
- var width = inside ? $(el).innerWidth(): $(el).outerWidth();
- return width * (parseFloat(length)/100) + 'px';
+ if (dims) {
+ var len = inside ? dims.width : dims.outerWidth;
+ } else {
+ var len = inside ? $elem.width(): $elem.outerWidth();
+ }
+
}
+ return len * (parseFloat(length)/100) + 'px';
}
// convert all other units into pixels.
if ( !rnumpx.test( length ) && rnum.test( length ) ) {
// some lengths are relative to the item itself.
if (inside) {
- var div = $(el).append('<div>temporary</div>').find(':last');
- el = div[0];
+ var div = $elem.append('<div>temporary</div>').find(':last');
+ elem = div[0];
}
//decide which side to alter (this really only applies to percentages which we handle above)
var side = axis == 'y' ? 'top' : 'left';
// TODO: there's some duplicated code going on here.
- if (!el.runtimeStyle && document.defaultView && document.defaultView.getComputedStyle) { // FF, WebKit, Opera
+ if (!elem.runtimeStyle && document.defaultView && document.defaultView.getComputedStyle) { // FF, WebKit, Opera
// remember the originals
- var style = el.style[side];
- var position = el.style.position;
+ var style = elem.style[side];
+ var position = elem.style.position;
// set some new styles
- el.style[side] = length || 0;
- el.style.position = 'relative'; // we need to be positioned for Moz to work
+ elem.style[side] = length || 0;
+ elem.style.position = 'relative'; // we need to be positioned for Moz to work
// pull out the pixel values
- length = document.defaultView.getComputedStyle(el, null)[side];
+ length = document.defaultView.getComputedStyle(elem, null)[side];
// undo our mess
- el.style[side] = style;
- el.style.position = position;
+ elem.style[side] = style;
+ elem.style.position = position;
} else { //IE
// remember the originals
- var style = el.style[side];
- var runtimeStyle = el.runtimeStyle[side];
+ var style = elem.style[side];
+ var runtimeStyle = elem.runtimeStyle[side];
// set some new styles
- el.runtimeStyle[side] = el.currentStyle[side];
- el.style[side] = length || 0;
+ elem.runtimeStyle[side] = elem.currentStyle[side];
+ elem.style[side] = length || 0;
// pull out the pixel values
- length = axis == 'y' ? el.style.pixelTop : el.style.pixelLeft + 'px';
+ length = axis == 'y' ? elem.style.pixelTop : elem.style.pixelLeft + 'px';
// undo our mess
- el.style[side] = style;
- el.runtimeStyle[side] = runtimeStyle;
+ elem.style[side] = style;
+ elem.runtimeStyle[side] = runtimeStyle;
}
- // remove the dive we created
+ // remove the div we created
if (inside) {
div.remove();
}
}
return length;
}
-})(jQuery);
+})(jQuery, this, this.document);

0 comments on commit 4cd7bf2

Please sign in to comment.
Something went wrong with that request. Please try again.