Skip to content

CharlotteGore/detect-transition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

detect-transition

Feature detection and property finder for CSS3 transition, transform and transition-timing-function properties.

Installation

NPM/Browserify

$ npm install --save detect-transition

API

Run the detector and get the correct properties by requiring the module.

var transforms = require('detect-transition');

require('detect-transition').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
  }

require('detect-transition').transform

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 ...
  }

require('detect-transition').timingFunctions

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 ...
  }

License

MIT

About

Gets the correctly prefixed strings for CSS3 transition, transform and transition-timing-function

Resources

Stars

Watchers

Forks

Packages

No packages published