Last active
January 18, 2016 23:14
-
-
Save redgoose-dev/917203215e30a563603f to your computer and use it in GitHub Desktop.
CSS3 Util class
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
/** | |
* 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