(function($){$.animateElement=function(el,options){var that=this;that.$el=$(el);that.el=el;that.$el.data("animateElement",that);that.init=function(){that.options=$.extend({},$.animateElement.defaultOptions,options);that.processClasses();that.setupEvents()};that.isMobile=function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch;};that.processClasses=function(){var wrapper=$(that.options.sectionRoot);var animateClass=that.options.animateSelector.replace(/.+?(?=ani-)/,""),animateClass=animateClass.replace(/(\::.*)|(\>.*)|(\s.*)/,"");var applyToElememt=that.options.animateSelector.match(/(.+?(?=ani-))/);var path=applyToElememt[0],elementPath=that.options.sectionRoot+that.options.directDescendent+path.slice(0,path.length-1);$(elementPath).addClass(animateClass);wrapper.addClass(that.options.effect).addClass(that.options.filter);};that.setupEvents=function(){var wrapper=$(that.options.sectionRoot);if(!that.isMobile()||(that.isMobile()&&that.options.touchAni)){if(that.options.startOn=='page-load'){wrapper.addClass('pre-eff-'+that.options.stackid);$(window).load(function(){setTimeout(function(){wrapper.addClass('animate-'+that.options.stackid).removeClass('pre-eff-'+that.options.stackid);},that.options.delay);});}
if(that.options.startOn=='hover'){wrapper.addClass('pre-hover');wrapper.addClass('pre-eff-'+that.options.stackid);that.$el.hover(function(){setTimeout(function(){wrapper.removeClass('pre-hover').addClass('animate-'+that.options.stackid).removeClass('pre-eff-'+that.options.stackid);},that.options.delay);},function(){wrapper.removeClass('animate-'+that.options.stackid).addClass('pre-eff-'+that.options.stackid)});}
if(that.options.startOn=='in-view'){that.$el.addClass('inview');wrapper.addClass('pre-eff-'+that.options.stackid);that.$el.on('inview',function(event,isInView){if(isInView){setTimeout(function(){wrapper.addClass('animate-'+that.options.stackid).removeClass('pre-eff-'+that.options.stackid);},that.options.delay);}else{if(that.options.repeat)wrapper.removeClass('animate-'+that.options.stackid).addClass('pre-eff-'+that.options.stackid);};});$(window).on('load',function(){setTimeout(function(){$(window).trigger('checkInView');},10);});}
if(that.options.startOn=='ll-in-view'){var ll=wrapper.closest('.splb');var infix='#splb_'+ll.attr('id');if(ll){wrapper.addClass('pre-eff-'+that.options.stackid);$(document).on('infix:reopen',function(event,instance){if($(event.target)[0]==$(infix)[0]){setTimeout(function(){wrapper.addClass('animate-'+that.options.stackid).removeClass('pre-eff-'+that.options.stackid);},that.options.delay);}});$(document).on('infix:hide',function(event,instance){if($(event.target)[0]==$(infix)[0]){if(that.options.repeat){wrapper.removeClass('animate-'+that.options.stackid).addClass('pre-eff-'+that.options.stackid);}}});}}}else{if(that.options.touchAction=='touch-start'){wrapper.addClass('pre-eff-'+that.options.stackid).addClass('pre-hover').removeClass('animate-'+that.options.stackid);}else{wrapper.addClass('animate-'+that.options.stackid).addClass('pre-hover').removeClass('pre-eff-'+that.options.stackid);}}};that.init();};$.animateElement.defaultOptions={stackid:'',sectionRoot:'.sections_stack>.s-pro',repeat:false,startOn:'page-load',animateSelector:'',effect:'',filter:'',delay:0,touchAction:'touch-start',touchAni:true,directDescendent:''};$.fn.animateElement=function(options){return this.each(function(){(new $.animateElement(this,options));});};$.fn.getanimateElement=function(){this.data("animateElement");};})(jQuery);
