componentDidMount(){
ReactDOM.findDOMNode(this).addEventListener(
transitionEndEventName(), this.onTransitionEnd, false);
ReactDOM.findDOMNode(this).addEventListener(
transitionStartEventName(),this.onTransitionStart, false);
}
function transitionStartEventName () {
var i,
undefined,
el = document.createElement('div'),
transitions = {
'transition':'transitionstart',
'OTransition':'otransitionstart',
// oTransitionEnd in very old Opera
'MozTransition':'transitionstart',
'WebkitTransition':'webkitTransitionStart'
};
for (i in transitions) {
if (transitions.hasOwnProperty(i) && el.style[i] !== undefined) {
return transitions[i];
}
}
//TODO: throw 'TransitionEnd event is not supported in this browser';
}
在Chrome中的onTransitionEnd可以完美运行,但transitionStartEventName尚未启动