transform-style
Apply transform style property with proper prefix to an element. For use with browserify / CommonJS.
Last updated 5 years ago by henrikjoreteg .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install transform-style 
SYNC missed versions from official npm registry.

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 = require('transform-style');

// get an element 
var el = document.getElementById('#someId');

// pass it the element and whatever transform you want
applyTransform(el, 'translateY(40px)');

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 = require('transform-style');

// get an element 
var el = document.getElementById('#someId');

// will move it 20px right
applyTransform(el, 'translateX(20px)');

// will move it *an additional* 20px right (40px total)
applyTransform(el, 'translateX(20px)', true);

// this will return it to original position (not additive)
applyTransform(el, 'translateX(0px)');

credits

If you like this, follow @HenrikJoreteg on twitter.

license

MIT

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

3 Versions

  • 1.0.0                                ...           5 years ago
  • 0.1.0                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (0)
None
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |