-
Notifications
You must be signed in to change notification settings - Fork 7
/
morphist.min.js
1 lines (1 loc) · 1.12 KB
/
morphist.min.js
1
/*! Morphist - v2.0.0 - 2015-01-17 */!function(a){"use strict";function b(b,c){this.element=a(b),this.settings=a.extend({},d,c),this._defaults=d,this._init()}var c="Morphist",d={animateIn:"bounceIn",animateOut:"rollOut",speed:2e3,complete:a.noop};b.prototype={_init:function(){this.children=this.element.children(),this.element.addClass("morphist"),this.index=0,this.cycle()},cycle:function(){var b=this;this._animateIn(),this._timeout=setTimeout(function(){b._animateOut().one("webkitAnimationEnd mozAnimationEnd MSAnimationEndoanimationend animationend",function(){a(this).removeClass(),b.index+1===b.children.length&&(b.index=-1),++b.index,b.cycle()})},this.settings.speed),a.isFunction(this.settings.complete)&&this.settings.complete.call(this)},stop:function(){clearTimeout(this._timeout)},_animateIn:function(){return this.children.eq(this.index).addClass("animated "+this.settings.animateIn)},_animateOut:function(){return this.children.eq(this.index).removeClass().addClass("animated "+this.settings.animateOut)}},a.fn[c]=function(d){return this.each(function(){a.data(this,"plugin_"+c)||a.data(this,"plugin_"+c,new b(this,d))})}}(jQuery);