!function(a,b,c,d){a.fn.sticky=function(c){var e,f=a(this),g=f.selector||"",h=(new Date).getTime(),i=[],j=arguments[0],k="string"==typeof j,l=[].slice.call(arguments,1);return f.each(function(){var f,m,n=a.extend(!0,{},a.fn.sticky.settings,c),o=n.className,p=n.namespace,q=n.error,r="."+p,s="module-"+p,t=a(this),u=a(b),v=t.offsetParent(),w=(t.selector||"",t.data(s)),x=b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,0)},y=this;m={initialize:function(){return f=n.context?a(n.context):v,0===f.size()?void m.error(q.invalidContext,n.context,t):(m.supports.sticky(),u.on("resize"+r,m.event.resize).on("scroll"+r,m.event.scroll),m.verbose("Initializing sticky",n,v),m.save.positions(),void m.instantiate())},instantiate:function(){m.verbose("Storing instance of module",m),w=m,t.data(s,m)},destroy:function(){m.verbose("Destroying previous module"),m.reset(),u.off("resize",m.event.resize).off("scroll",m.event.scroll),t.removeData(s)},event:{resize:function(){x(m.refresh)},scroll:function(){x(function(){m.stick(),a.proxy(n.onScroll,y)()})}},refresh:function(b){m.reset(),b&&(v=t.offsetParent()),m.save.positions(),a.proxy(n.onReposition,y)()},supports:{sticky:function(){{var b=a("
");b.get()}return b.addClass(o.supported),b.css("position").match("sticky")}},save:{scroll:function(a){m.lastScroll=a},positions:function(){var a={height:u.height()},b={margin:{top:parseInt(t.css("margin-top"),10),bottom:parseInt(t.css("margin-bottom"),10)},offset:t.offset(),width:t.outerWidth(),height:t.outerHeight()},c={offset:f.offset(),height:f.outerHeight()};m.cache={fits:b.heighta&&(b="up")),b},currentOffset:function(){return m.is.top()?parseInt(t.css("top"),10)||0:parseInt(t.css("bottom"),10)||0},offsetChange:function(a){return a=a||u.scrollTop(),m.lastScroll?Math.abs(a-m.lastScroll):0},newOffset:function(a){a=a||u.scrollTop();var b=m.get.currentOffset(),c=m.get.offsetChange(a);return Math.abs(b-c)}},set:{containerSize:function(){var a=v.get(0).tagName;"HTML"===a||"body"==a?t.is(":visible")&&(m.error(q.container,a,t),v=t.offsetParent()):(m.debug("Settings container size",m.cache.context.height),v.height(m.cache.context.height))},size:function(){t.css({width:m.cache.element.width,height:m.cache.element.height})}},is:{top:function(){return t.hasClass(o.top)},bottom:function(){return t.hasClass(o.bottom)},bound:function(){return t.hasClass(o.bound)},fixed:function(){return t.hasClass(o.fixed)}},stick:function(){var a=m.cache,b=a.fits,c=a.element,d=a.window,e=a.context,f=u.scrollTop(),g={top:f+n.offset,bottom:f+d.height+n.offset},h=m.get.direction(f),i=(m.get.currentOffset(),m.get.newOffset(f)),j=g.bottom>c.top+c.height,k=a.element.height+g.top;m.save.scroll(f),m.is.fixed()?b?(m.is.top()&&(g.tope.bottom&&(m.debug("Top attached rail has reached bottom of container"),m.bindBottom())),m.is.bottom()&&(g.bottom-c.heighte.bottom&&(m.debug("Bottom attached rail has reached bottom of container"),m.bindBottom())),k>e.bottom&&m.bindBottom()):g.bottom>e.bottom?m.bindBottom():j?(m.is.top()&&"down"==h&&(m.debug("Stuck content at bottom edge"),i>=c.height-d.height?(t.css("top",""),m.stickBottom()):t.css("top",-i)),m.is.bottom()&&"up"==h&&(m.debug("Stuck content at top edge"),i>=c.height-d.height?(t.css("bottom",""),m.stickTop()):t.css("bottom",-i))):m.unfix():(g.top+c.height>e.bottom&&m.bindBottom(),b?m.is.bottom()?n.pushing?m.is.bound()&&g.bottom=c.top&&g.top0&&(console.groupCollapsed(b),console.table?console.table(i):a.each(i,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),i=[]}},invoke:function(b,c,f){var g,h,i,j=w;return c=c||l,f=y||f,"string"==typeof b&&j!==d&&(b=b.split(/[\. ]/),g=b.length-1,a.each(b,function(c,e){var f=c!=g?e+b[c+1].charAt(0).toUpperCase()+b[c+1].slice(1):b;if(a.isPlainObject(j[f])&&c!=g)j=j[f];else{if(j[f]!==d)return h=j[f],!1;if(!a.isPlainObject(j[e])||c==g)return j[e]!==d?(h=j[e],!1):!1;j=j[e]}})),a.isFunction(h)?i=h.apply(f,c):h!==d&&(i=h),a.isArray(e)?e.push(i):e!==d?e=[e,i]:i!==d&&(e=i),h}},k?(w===d&&m.initialize(),m.invoke(j)):(w!==d&&m.destroy(),m.initialize())}),e!==d?e:this},a.fn.sticky.settings={name:"Sticky",namespace:"sticky",verbose:!0,debug:!1,performance:!0,pushing:!1,context:!1,offset:0,onReposition:function(){},onScroll:function(){},onStick:function(){},onUnstick:function(){},onTop:function(){},onBottom:function(){},error:{container:"Sticky element must be inside a relative container",method:"The method you called is not defined.",invalidContext:"Context specified does not exist"},className:{bound:"bound",fixed:"fixed",supported:"native",top:"top",bottom:"bottom"}}}(jQuery,window,document);