heygrady / transform

jQuery 2d transformation plugin
437 stars 87 forks source link

negative values leave NaN error #23

Closed bmtully closed 13 years ago

bmtully commented 13 years ago

hello. seem to be having a problem when using translate with negative values. for example:

This will not work: $('#top').animate({'marginTop': ['-7em', 'easeOutQuad']}, 2000, function() {});

If i examine the code during the transform, note that i'm missing the "-webkit-transform" property that the successful transforms display, and instead i've got a number error: div id="top" data-transform="translateY(NaNem)"

any ideas? if i store the number inside a variable, as an integer, it seems to work with a negative value. however, it defaults to PX and I'm trying to lay out the page in EMs.

Thanks! Brian

heygrady commented 13 years ago
  1. your example isn't using translate, it's using marginTop. I assume that's just a typo.
  2. You're using per-property easing which is really strangely handled by jQuery.animate. If you're only using one type of easing, pass it in as an option or an argument, not as part of the property value.
  3. I'll look into this as soon as I can. Negative values and non-px units should be supported.