Created
July 5, 2014 12:13
-
-
Save kentaromiura/ecde2b2ceb999e325be3 to your computer and use it in GitHub Desktop.
Feature detection for applying a transform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var transform = (function(){ | |
for(var props = ['transform', 'webkitTransform', 'OTransform', 'msTransform', 'MozTransform'], i=0, max=props.length; i<max; i++){ | |
var prop = props[i] | |
if(prop in document.body.style){ | |
return function(element, transformation){ | |
element.style[prop] = transformation | |
} | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment