transform-style
Apply transform style property with proper prefix to an element. For use with browserify / webpack / CommonJS.
There are times when it makes sense to position items using JS and transforms are the most performant way to do it. Hence, this tiny library.
installing
npm i transform-style
using
var applyTransform = ; // get an element var el = document; // pass it the element and whatever transform you want;
note: It works by replacing whatever is in -{{prefix}}-transform
. If you wish to transform in an additive way, pass true
as a third argument like this:
var applyTransform = ; // get an element var el = document; // will move it 20px right; // will move it *an additional* 20px right (40px total); // this will return it to original position (not additive);
credits
If you like this, follow @HenrikJoreteg on twitter.
license
MIT