Feature detection and property finder for CSS3 transition, transform and transition-timing-function properties.
NPM/Browserify
$ npm install --save detect-transition
Run the detector and get the correct properties by requiring the module.
var transforms = require('detect-transition');
Returns either the correct transition
property for the browser or false.
- transition
- -webkit-transition
- MozTransition
- msTransition
if (transforms.transition){
el.style[transforms.transition] = "width 2s;"
} else {
// some fallback system... no css transitions supported
}
Returns either the correct transform
property for the browser or false.
- transform
- -webkit-transform
- MozTransform
- msTransform
if (transforms.transform){
el.style[transforms.transform] = "rotateY(15deg)";
} else {
// some fallback system ...
}
Returns either the correct timing-function
property for the browser or false.
- transitionTimingFunction
- -webkit-transition-timing-function
- MozTransitionTimingFunction
- msTransitionTimingFunction
if (transforms.timingFunctions){
el.style[transforms.timingFunctions] = "ease-in";
} else {
// some fallback system ...
}
MIT