Closed MartinodF closed 11 years ago
good call. we need tests for this too
I added the simplest test I could think of, trying to be consistent with the already-existing ones. I rebased it on your master, I hope it's alright!
Note that I had to test a unit other than px
(I used -10%
) because morpheus defaults to pixels, so it would've worked anyway even if it discarded the unit. Also, I didn't add a test for plus-prefixed values. If you think I should, just tell me.
Edit: I haven't updated /morpheus.js
and /morpheus.min.js
, I'm not sure if I should have.
Thanks!
this is perfect!
The regular expression used to extract the unit (%, em, ...) doesn't work with negative values (and plus-prefixed values, but that's just an edge case).
Adding a
?
after the equal sign allows Morpheus to work correctly when animating to values such as -100%, -50px, -2cm and +150%.A very common use case is writing carousels / page sliders et similia since we often want to animate left to -100%.