1 line
1.6 KiB
JavaScript
1 line
1.6 KiB
JavaScript
!function(n,i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof exports?module.exports=i(require("jquery")):n.MotionUI=i(n.jQuery)}(this,function(u){"use strict";!function(){Date.now||(Date.now=function(){return(new Date).getTime()});for(var n=["webkit","moz"],i=0;i<n.length&&!window.requestAnimationFrame;++i){var e=n[i];window.requestAnimationFrame=window[e+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e+"CancelAnimationFrame"]||window[e+"CancelRequestAnimationFrame"]}if(/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent)||!window.requestAnimationFrame||!window.cancelAnimationFrame){var t=0;window.requestAnimationFrame=function(n){var i=Date.now(),e=Math.max(t+16,i);return setTimeout(function(){n(t=e)},e-i)},window.cancelAnimationFrame=clearTimeout}}();var s=["mui-enter","mui-leave"],m=["mui-enter-active","mui-leave-active"],d=function(){var n={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend"},i=window.document.createElement("div");for(var e in n)if(void 0!==i.style[e])return n[e];return null}();function t(n,i,e,t){if((i=u(i).eq(0)).length){if(null===d)return n?i.show():i.hide(),void t();var o=n?s[0]:s[1],a=n?m[0]:m[1];r(),i.addClass(e),i.css("transition","none"),requestAnimationFrame(function(){i.addClass(o),n&&i.show()}),requestAnimationFrame(function(){i[0].offsetWidth,i.css("transition",""),i.addClass(a)}),i.one("transitionend",function(){n||i.hide();r(),t&&t.apply(i)})}function r(){i[0].style.transitionDuration=0,i.removeClass(o+" "+a+" "+e)}}return{animateIn:function(n,i,e){t(!0,n,i,e)},animateOut:function(n,i,e){t(!1,n,i,e)}}}); |