Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* From Modernizr */
- function whichTransitionEvent() {
- var t;
- var el = document.createElement('fakeelement');
- var transitions = {
- 'transition': 'transitionend',
- 'OTransition': 'oTransitionEnd',
- 'MozTransition': 'transitionend',
- 'WebkitTransition': 'webkitTransitionEnd'
- }
- for (t in transitions) {
- if (el.style[t] !== undefined) {
- return transitions[t];
- }
- }
- }
- /* Listen for a transition! */
- var transitionEvent = whichTransitionEvent();
- const
- onTransitionEnd = function (el, fn) {
- // console.log('entering here...', fn);
- transitionEvent && el.addEventListener(transitionEvent, function() {
- // console.log('done!');
- fn();
- });
- };
- export default onTransitionEnd;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement