!function(e,t,s,i){"use strict";var n="stickThis",l={top:null,position:"top",minscreenwidth:null,maxscreenwidth:null,screen_small:!0,screen_medium:!0,screen_large:!0,screen_extralarge:!0,zindex:1,bottom_trigger:"0",legacymode:!1,dynamicmode:!1,debugmode:!1,pushup:"",adminbar:!1,opacity:100,scroll_range_min:0,scroll_range_max:100,fade_in:!1,slide_down:!1},a=0;function o(t,s){this.element=t,this.settings=e.extend({},l,s),this._defaults=l,this._name=n,this.init()}e.extend(o.prototype,{init:function(){e(this.element);var s=e(this.element).length,i=e(this.settings.pushup).length;i<1?(1==this.settings.debugmode&&this.settings.pushup&&console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the Push-up element ("'+this.settings.pushup+'").'),this.settings.pushup=""):i>1&&(1==this.settings.debugmode&&console.error("STICKY ANYTHING DEBUG: There are "+i+' elements on the page with the selector/class/ID you selected for the push-up element ("'+this.settings.pushup+'"). You can select only ONE element to push the sticky element up.'),this.settings.pushup=""),s<1?1==this.settings.debugmode&&console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'").'):s>1&&1==this.settings.debugmode&&console.error("STICKY ANYTHING DEBUG: There There are "+i+' elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'"). You can only make ONE element sticky.'),null==this.settings.top?this.settings.top=0:isNaN(parseInt(this.settings.top))?this.settings.top=e(this.settings.top).height():this.settings.top=parseInt(this.settings.top),e(this.element).addClass("sticky-element-original element-is-not-sticky sticky-element-active");var n=this.cssStyles(),l=e(this.element).attr("style");if(null==l&&(l=""),this.createPlaceholder(),"bottom"==this.settings.position)if(this.settings.bottom_trigger.indexOf("%")>0){var o=parseInt(this.settings.bottom_trigger.substr(0,this.settings.bottom_trigger.indexOf("%")));a=e("body").height()*(o/100)}else a=parseInt(this.settings.bottom_trigger);var r=0,c=this;e(t).scroll(function(){clearTimeout(r),r=setTimeout(function(){c.check(c.settings,l)},10)});var h=0;e(t).resize(function(){clearTimeout(h),h=setTimeout(function(){c.unstickIt(l),c.check(c.settings,l,n)},50)}),this.check(this.settings,l,n)},cssStyles:function(){var t={},s=e(this.element);return t.display=s.css("display"),t.float=s.css("float"),t.flex=s.css("flex"),t["box-sizing"]=s.css("box-sizing"),t.clear=s.css("clear"),t.overflow=s.css("overflow"),t.transform=s.css("transform"),t},createPlaceholder:function(){var t=e('
');e(this.element).before(t).data("placeholder",t)},createClone:function(t,s){var i=e(this.element).clone();e(this.element).data("clone",i),i.insertAfter(this.element).addClass("sticky-element-cloned").removeClass("element-is-not-sticky").addClass("element-is-sticky").css("position","fixed").css("top",t+"px").css("margin-left","0").css("z-index",s).removeClass("sticky-element-original").hide()},check:function(i,n,l){var o=t,r="inner";"innerWidth"in t||(r="client",o=s.documentElement||s.body);var c=o[r+"Width"],h=o[r+"Height"],m=null!=i.minscreenwidth&&null!=i.maxscreenwidth;if(!m||!(ci.maxscreenwidth)){if(!m){if(c<768&&!i.screen_small)return;if(c>=768&&c<992&&!i.screen_medium)return;if(c>=992&&c<1200&&!i.screen_large)return;if(c>1200&&!i.screen_extralarge)return}var d=e(this.element).hasClass("sticky-element-active")?e(this.element):e(this.element).data("placeholder"),p=d.offset().top,g=0;if(i.pushup)g=e(i.pushup).offset().top;var u=0;i.adminbar&&e("body").hasClass("admin-bar")&&c>600&&(u=e("#wpadminbar").height());var f=e(this.element).outerHeight(),y=p-i.top-u;(i.fade_in||i.slide_down)&&(y+=f);var v=e(t).scrollTop()>y,k=e(t).scrollTop()>a,_=e(t).scrollTop()/h*100;(i.scroll_range_min>0&&_i.scroll_range_max)&&(v=!1,k=!1);f=e(this.element).outerHeight();if(!e(this.element).data("isAnimating")){var x=!1;if("top"==i.position&&v||"bottom"==i.position&&k){var b=e(this.element).hasClass("element-is-sticky");i.pushup&&e(t).scrollTop()>g-i.top-f-u?(b&&this.unstickIt(n),x=!0):b||this.stickIt(i,d,l,u,g,f,n),b||x||this.stickIt(i,d,l,u,g,f,n)}else this.unstickIt(n),e(this.element).data("sticky",!1)}}},stickIt:function(s,i,n,l,a,o,r){if(!e(this.element).data("isAnimating")){var c=i.offset().left,h=i[0].getBoundingClientRect().width;h||(h=i.css("width")),h=(h+"").replace(/px/,"");var m=i[0].getBoundingClientRect().height;m||(m=i.css("height")),m=(m+"").replace(/px/,"");var d=e(this.element).css("width");"0px"==d&&(d=this.element.getBoundingClientRect().width);e(this.element).height();var p=[e(this.element).css("padding-top"),e(this.element).css("padding-right"),e(this.element).css("padding-bottom"),e(this.element).css("padding-left")].join(" "),g=[i.css("margin-top"),i.css("margin-right"),i.css("margin-bottom"),i.css("margin-left")].join(" "),u="";for(var f in n)"inline"==n[f]?u+=f+":inline-block; ":u+=f+":"+n[f]+"; ";s.pushup&&e(t).scrollTop()>a-s.top-o-l?s.topMargin=a-s.top-o-e(t).scrollTop():s.topMargin=l,u+="height:"+m+"px; margin:"+g+";",e(this.element).removeClass("sticky-element-active").removeClass("element-is-not-sticky").addClass("element-is-sticky").css("cssText",r+"margin-top: "+s.topMargin+"px !important; margin-left: 0 !important").css("position","fixed").css("left",c+"px").css("width",d).css("padding",p).css("z-index",s.zindex).css(s.position,s.top-o).css("opacity",0);var y=e(this.element).data("sticky"),v=s.fade_in&&!y?500:0,k=s.slide_down&&!y?500:0;if(500==v||500==k){e(this.element).data("isAnimating",!0);var _=e(this.element);setTimeout(function(){_.data("isAnimating",!1)},500)}e(this.element).fadeTo(v,s.opacity/100);var x={};x[s.position]=s.top,e(this.element).animate(x,{duration:k,queue:!1}),e(this.element).data("placeholder").hasClass("sticky-element-active")||e(this.element).data("placeholder").addClass("sticky-element-active").attr("style",u),e(this.element).data("sticky",!0)}},unstickIt:function(t){e(this.element).addClass("sticky-element-active").removeClass("element-is-sticky").addClass("element-is-not-sticky").attr("style",t),e(this.element).data("placeholder").hasClass("sticky-element-active")&&e(this.element).data("placeholder").removeClass("sticky-element-active").removeAttr("style").css("width","0").css("height","0").css("margin","0").css("padding","0")}}),e.fn[n]=function(t){return this.each(function(){e.data(this,"plugin_"+n)||e.data(this,"plugin_"+n,new o(this,t))})}}(jQuery,window,document);