Skip to content

Instantly share code, notes, and snippets.

@defims
Forked from nesk/LICENSE.txt
Last active June 14, 2016 02:46
Show Gist options
  • Save defims/edc892cbba6c75c883c1e8eb7e77372e to your computer and use it in GitHub Desktop.
Save defims/edc892cbba6c75c883c1e8eb7e77372e to your computer and use it in GitHub Desktop.
Detect CSS 3 transitions support
// 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
;
}
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}
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.
{
"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"
}
<!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