Created
March 14, 2012 17:36
-
-
Save dgalarza/2038118 to your computer and use it in GitHub Desktop.
jQuery CSS Transition Fallbacks
This file contains 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 (window, doc, $, undefined) { | |
// Check for CSS3 Transition Support | |
var css_transitions = function() { | |
var el = doc.createElement('div'); | |
var vendors = ['Khtml', 'Ms', 'Moz',' Webkit','O']; | |
for (var i = 0, len = vendors.length; i < len; i++) { | |
var prop = vendors[i] + 'Transition'; | |
if (prop in el.style) return true; | |
} | |
return false; | |
}(); | |
/** | |
* Assuming a transition CSS definition is applied to .animate-me for width | |
* @see http://api.jquery.com/animate/ | |
* @see http://api.jquery.com/css/ | |
*/ | |
var method = (css_transitions) ? 'css' : 'animate'; | |
$('.animate-me')[method]({ | |
width: 100 | |
}); | |
})(window, document, jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment