/** * Sticky Plugin v1.0.2 for jQuery ======================================= * * Author: Anthony Garand * * Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk) * Improvements by Leonardo C. Daronco (daronco) * Created: 2/14/2011 * Date: 16/04/2015 * Website: http://labs.anthonygarand.com/sticky * * Description: Makes an element on the page stick on the screen as you scroll * It will only set the 'top' and 'position' of your element, you * might need to adjust the width in some cases. */ !function(t){var e=Array.prototype.slice,i=Array.prototype.splice,r={topSpacing:0,bottomSpacing:0,className:"is-sticky",wrapperClassName:"sticky-wrapper",center:!1,getWidthFrom:"",widthFromWrapper:!0,responsiveWidth:!1},n=t(window),s=t(document),o=[],c=n.height(),a=function(){for(var e=n.scrollTop(),i=s.height(),r=i-c,a=e>r?r-e:0,p=0;ph||null===l.currentTop&&h").attr("id",c).addClass(i.wrapperClassName);e.wrapAll(a);var p=e.parent();i.center&&p.css({width:e.outerWidth(),marginLeft:"auto",marginRight:"auto"}),"right"==e.css("float")&&e.css({float:"none"}).parent().css({float:"right"}),p.css("height",s),i.stickyElement=e,i.stickyWrapper=p,i.currentTop=null,o.push(i)})},update:a,unstick:function(e){return this.each(function(){for(var e=t(this),r=-1,n=o.length;n-- >0;)o[n].stickyElement.get(0)===this&&(i.call(o,n,1),r=n);-1!=r&&(e.unwrap(),e.css({width:"",position:"",top:"",float:""}))})}};window.addEventListener?(window.addEventListener("scroll",a,!1),window.addEventListener("resize",p,!1)):window.attachEvent&&(window.attachEvent("onscroll",a),window.attachEvent("onresize",p)),t.fn.sticky=function(i){return l[i]?l[i].apply(this,e.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist on jQuery.sticky"):l.init.apply(this,arguments)},t.fn.unstick=function(i){return l[i]?l[i].apply(this,e.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist on jQuery.sticky"):l.unstick.apply(this,arguments)},t(function(){setTimeout(a,0)})}(jQuery);