- commit
- 1ddffdd98c9e0c4294b160dca22a38c113ad1f7b
- parent
- 101b16030067fdc8b8c2c45bc27391b7e898a994
- Author
- leaf corcoran <leafot@gmail.com>
- Date
- 2014-11-20 07:50
strip left over height that might have been added on detach
Diffstat
| M | jquery.sticky-kit.coffee | 1 | + |
| M | jquery.sticky-kit.js | 3 | ++- |
| M | jquery.sticky-kit.min.js | 10 | +++++----- |
3 files changed, 8 insertions, 6 deletions
diff --git a/jquery.sticky-kit.coffee b/jquery.sticky-kit.coffee
@@ -208,6 +208,7 @@ $.fn.stick_in_parent = (opts={}) ->
208 208 position: ""
209 209 bottom: ""
210 210 top: ""
-1 211 height: ""
211 212 }
212 213
213 214 parent.position "position", ""
diff --git a/jquery.sticky-kit.js b/jquery.sticky-kit.js
@@ -204,7 +204,8 @@ 204 204 elm.css({ 205 205 position: "", 206 206 bottom: "",207 -1 top: ""-1 207 top: "", -1 208 height: "" 208 209 }); 209 210 parent.position("position", ""); 210 211 if (fixed) {
diff --git a/jquery.sticky-kit.min.js b/jquery.sticky-kit.min.js
@@ -1,9 +1,9 @@ 1 1 /* 2 2 Sticky-kit v1.1.0 | WTFPL | Leaf Corcoran 2014 | http://leafo.net 3 3 */4 -1 (function(){var k,e;k=this.jQuery||window.jQuery;e=k(window);k.fn.stick_in_parent=function(d){var w,y,n,r,h,C,s,F,p,G;null==d&&(d={});s=d.sticky_class;y=d.inner_scrolling;C=d.recalc_every;h=d.parent;r=d.offset_top;n=d.spacer;w=d.bottoming;null==r&&(r=0);null==h&&(h=void 0);null==y&&(y=!0);null==s&&(s="is_stuck");null==w&&(w=!0);F=function(a,d,p,z,D,t,q){var u,E,m,A,c,f,B,x,v,g,b;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);f=a.parent();null!=h&&(f=f.closest(h));if(!f.length)throw"failed to find stick parent";-1 4 (function(){var k,e;k=this.jQuery||window.jQuery;e=k(window);k.fn.stick_in_parent=function(d){var v,y,n,r,h,C,s,F,p,G;null==d&&(d={});s=d.sticky_class;y=d.inner_scrolling;C=d.recalc_every;h=d.parent;r=d.offset_top;n=d.spacer;v=d.bottoming;null==r&&(r=0);null==h&&(h=void 0);null==y&&(y=!0);null==s&&(s="is_stuck");null==v&&(v=!0);F=function(a,d,p,z,D,t,q){var u,E,m,A,c,f,B,w,x,g,b;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);f=a.parent();null!=h&&(f=f.closest(h));if(!f.length)throw"failed to find stick parent"; 5 5 u=m=!1;(g=null!=n?n&&a.closest(n):k("<div />"))&&g.css("position",a.css("position"));B=function(){var c,e,l;c=parseInt(f.css("border-top-width"),10);e=parseInt(f.css("padding-top"),10);d=parseInt(f.css("padding-bottom"),10);p=f.offset().top+c+e;z=f.height();m&&(u=m=!1,null==n&&(a.insertAfter(g),g.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(s),l=!0);D=a.offset().top-parseInt(a.css("margin-top"),10)-r;t=a.outerHeight(!0);q=a.css("float");g&&g.css({width:a.outerWidth(!0),height:t,6 -1 display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":q});if(l)return b()};B();if(t!==z)return A=void 0,c=r,v=C,b=function(){var b,k,l,h;null!=v&&(v-=1,0>=v&&(v=C,B()));l=e.scrollTop();null!=A&&(k=l-A);A=l;m?(w&&(h=l+t+c>z+p,u&&!h&&(u=!1,a.css({position:"fixed",bottom:"",top:c}).trigger("sticky_kit:unbottom"))),l<D&&(m=!1,c=r,null==n&&("left"!==q&&"right"!==q||a.insertAfter(g),g.detach()),b={position:"",width:"",top:""},a.css(b).removeClass(s).trigger("sticky_kit:unstick")),y&&7 -1 (b=e.height(),t>b&&!u&&(c-=k,c=Math.max(b-t,c),c=Math.min(r,c),m&&a.css({top:c+"px"})))):l>D&&(m=!0,b={position:"fixed",top:c},b.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(b).addClass(s),null==n&&(a.after(g),"left"!==q&&"right"!==q||g.append(a)),a.trigger("sticky_kit:stick"));if(m&&w&&(null==h&&(h=l+t+c>z+p),!u&&h))return u=!0,"static"===f.css("position")&&f.css({position:"relative"}),a.css({position:"absolute",bottom:d,top:"auto"}).trigger("sticky_kit:bottom")},8 -1 x=function(){B();return b()},E=function(){e.off("touchmove",b);e.off("scroll",b);e.off("resize",x);k(document.body).off("sticky_kit:recalc",x);a.off("sticky_kit:detach",E);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:""});f.position("position","");if(m)return null==n&&("left"!==q&&"right"!==q||a.insertAfter(g),g.remove()),a.removeClass(s)},e.on("touchmove",b),e.on("scroll",b),e.on("resize",x),k(document.body).on("sticky_kit:recalc",x),a.on("sticky_kit:detach",E),setTimeout(b,0)}};p=9 -1 0;for(G=this.length;p<G;p++)d=this[p],F(k(d));return this}}).call(this);-1 6 display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":q});if(l)return b()};B();if(t!==z)return A=void 0,c=r,x=C,b=function(){var b,k,l,h;null!=x&&(--x,0>=x&&(x=C,B()));l=e.scrollTop();null!=A&&(k=l-A);A=l;m?(v&&(h=l+t+c>z+p,u&&!h&&(u=!1,a.css({position:"fixed",bottom:"",top:c}).trigger("sticky_kit:unbottom"))),l<D&&(m=!1,c=r,null==n&&("left"!==q&&"right"!==q||a.insertAfter(g),g.detach()),b={position:"",width:"",top:""},a.css(b).removeClass(s).trigger("sticky_kit:unstick")),y&& -1 7 (b=e.height(),t>b&&!u&&(c-=k,c=Math.max(b-t,c),c=Math.min(r,c),m&&a.css({top:c+"px"})))):l>D&&(m=!0,b={position:"fixed",top:c},b.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(b).addClass(s),null==n&&(a.after(g),"left"!==q&&"right"!==q||g.append(a)),a.trigger("sticky_kit:stick"));if(m&&v&&(null==h&&(h=l+t+c>z+p),!u&&h))return u=!0,"static"===f.css("position")&&f.css({position:"relative"}),a.css({position:"absolute",bottom:d,top:"auto"}).trigger("sticky_kit:bottom")}, -1 8 w=function(){B();return b()},E=function(){e.off("touchmove",b);e.off("scroll",b);e.off("resize",w);k(document.body).off("sticky_kit:recalc",w);a.off("sticky_kit:detach",E);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:"",height:""});f.position("position","");if(m)return null==n&&("left"!==q&&"right"!==q||a.insertAfter(g),g.remove()),a.removeClass(s)},e.on("touchmove",b),e.on("scroll",b),e.on("resize",w),k(document.body).on("sticky_kit:recalc",w),a.on("sticky_kit:detach",E),setTimeout(b, -1 9 0)}};p=0;for(G=this.length;p<G;p++)d=this[p],F(k(d));return this}}).call(this);