Created
June 21, 2011 16:38
-
-
Save dandean/1038271 to your computer and use it in GitHub Desktop.
Detect feature support for CSS3 transitions.
This file contains hidden or 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
| // warning: pseudo-code | |
| var TRANSITIONS_SUPPORTED = false; | |
| (function() { | |
| var div = document.createElement('div'); | |
| div.innerHTML = '<div style="transition:color 1s linear;-ms-transition:color 1s linear;-o-transition:color 1s linear;-webkit-transition:color 1s linear;-moz-transition:color 1s linear;"></div>'; | |
| var prefixes = ['', '-webkit-', '-moz-', '-o-', '-ms-']; | |
| for (var i=0; i<prefixes.length; i++) { | |
| if (prefixes[i] + 'transition' in div.firstChild.style) { | |
| TRANSITIONS_SUPPORTED = true; | |
| break; | |
| } | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment