Skip to content

Instantly share code, notes, and snippets.

@redgoose-dev
Last active January 18, 2016 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redgoose-dev/917203215e30a563603f to your computer and use it in GitHub Desktop.
Save redgoose-dev/917203215e30a563603f to your computer and use it in GitHub Desktop.
CSS3 Util class
/**
* CSS3 class
*/
var CSS3 = {
eventNames : {
WebkitTransition : 'webkitTransitionEnd',
MozTransition : 'transitionend',
OTransition : 'oTransitionEnd otransitionend',
transition : 'transitionend'
},
isSupport : function()
{
var el = document.createElement('div');
for (var name in this.eventNames) {
if (el.style[name] !== undefined) {
return this.eventNames[name];
}
}
el = null;
return false;
},
transitionEnd : function(el, callback)
{
if (this.isSupport())
{
if (callback)
{
$(el).one(this.isSupport(), callback);
}
}
else
{
$(el).one(this.isSupport(), callback);
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment