-
-
Save defims/edc892cbba6c75c883c1e8eb7e77372e to your computer and use it in GitHub Desktop.
Detect CSS 3 transitions support
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
// Function used to know if the current browser supports CSS transitions | |
function( | |
a,b // Placeholders | |
) { | |
a = (new Image).style; // Targeting a new image that will be used to analyze the style object | |
b = 'ransition'; // Part of the transition property, used to minified the code | |
return | |
't' + b in a || // All browsers support | |
'webkitT' + b in a || // Webkit browsers support (e.g. Chrome, Safari...) | |
'MozT' + b in a || // Gecko browsers support (e.g. Firefox, Camino...) | |
'OT' + b in a // Opera support | |
; | |
} |
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
export function(a,b){a=(new Image).style;b='ransition';return't'+b in a||'webkitT'+b in a||'MozT'+b in a||'OT'+b in a} |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Johann PARDANAUD : http://plune.fr | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
0. You just DO WHAT THE FUCK YOU WANT TO. |
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
{ | |
"name": "CSS 3 Transitions Detector", | |
"description": "Detects CSS 3 transitions support on many browsers", | |
"keywords": [ "CSS 3", "transitions", "detect", "crossbrowser", "animation" ], | |
"version": "0.1.0" | |
} |
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
<!DOCTYPE html> | |
<title>CSS 3 Transitions Detector</title> | |
<div>Expected value: <b>boolean</b></div> | |
<div>Actual value: <b id="ret"></b></div> | |
<script> | |
var transitionsSupported = function(a,b){a=(new Image).style;b='ransition';return't'+b in a||'webkitT'+b in a||'MozT'+b in a||'OT'+b in a}; | |
document.getElementById('ret').innerHTML = transitionsSupported(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment