- commit
- c5da295f94b94f00e743b1130ae4b4fdf46ba40d
- parent
- 5fca829c2c16a6df22ccacafa3f0fc2d0db004a0
- Author
- leaf corcoran <leafot@gmail.com>
- Date
- 2013-08-01 16:21
call tick right away
Diffstat
| M | Makefile | 3 | +++ |
| M | jquery.sticky-kit.coffee | 1 | + |
| M | jquery.sticky-kit.js | 1 | + |
| M | jquery.sticky-kit.min.js | 8 | ++++---- |
| M | site/www/src/jquery.sticky-kit.js | 1 | + |
| M | site/www/src/jquery.sticky-kit.min.js | 8 | ++++---- |
6 files changed, 14 insertions, 8 deletions
diff --git a/Makefile b/Makefile
@@ -6,3 +6,6 @@ jquery.sticky-kit.js: jquery.sticky-kit.coffee 6 6 coffee -c $< 7 7 8 8 -1 9 copy: -1 10 cp jquery.sticky-kit.js site/www/src/ -1 11 cp jquery.sticky-kit.min.js site/www/src/
diff --git a/jquery.sticky-kit.coffee b/jquery.sticky-kit.coffee
@@ -135,6 +135,7 @@ $.fn.stick_in_parent = (opts={}) ->
135 135 }).trigger("sticky_kit:bottom")
136 136
137 137 win.on "scroll", tick
-1 138 setTimeout tick, 0
138 139 $(document.body).on "sticky_kit:recalc", ->
139 140 recalc()
140 141 tick()
diff --git a/jquery.sticky-kit.js b/jquery.sticky-kit.js
@@ -146,6 +146,7 @@ 146 146 } 147 147 }; 148 148 win.on("scroll", tick); -1 149 setTimeout(tick, 0); 149 150 return $(document.body).on("sticky_kit:recalc", function() { 150 151 recalc(); 151 152 return tick();
diff --git a/jquery.sticky-kit.min.js b/jquery.sticky-kit.min.js
@@ -1,7 +1,7 @@ 1 1 /* 2 2 Sticky-kit v0.0.1 | WTFPL | Leaf Corcoran 2013 | http://leafo.net 3 3 */4 -1 (function(){var g,s;g=this.jQuery;s=g(window);g.fn.stick_in_parent=function(e){var t,c,p,A,k,B;null==e&&(e={});p=e.sticky_class;t=e.inner_scrolling;c=e.parent;null==c&&(c=void 0);null==t&&(t=!0);null==p&&(p="is_stuck");A=function(a,e,k,u,w,l){var n,q,f,v,b,d,x,y,r,z;d=a.parent();null!=c&&(d=d.closest(c));if(!d.length)throw"failed to find stick parent";x=function(){var b,f;b=parseInt(d.css("border-top-width"),10);f=parseInt(d.css("padding-top"),10);e=parseInt(d.css("padding-bottom"),10);k=d.offset().top+5 -1 b+f;u=d.height();w=a.offset().top-parseInt(a.css("margin-top"),10);return l=a.outerHeight(!0)};x();if(l!==u)return f=a.css("float"),r=g("<div />").css({width:a.outerWidth(!0),height:l,display:a.css("display"),"float":f}),n=q=!1,v=void 0,b=0,y=!1,z=function(){var h,g,m,c;m=s.scrollTop();null!=v&&(g=m-v);v=m;q?(c=m+l+b>u+k,n&&!c&&(n=!1,a.css({position:"fixed",bottom:"",top:0}).trigger("sticky_kit:unbottom")),m<w&&(q=!1,b=0,"left"!==f&&"right"!==f||a.insertAfter(r),r.detach(),h={position:""},y&&(h.width=6 -1 ""),a.css(h).removeClass(p).trigger("sticky_kit:unstick")),t&&(h=s.height(),l>h&&!n&&(b-=g,b=Math.max(h-l,b),b=Math.min(0,b),a.css({top:b+"px"})))):m>w&&(q=!0,h={position:"fixed",top:b},"none"===f&&"block"===a.css("display")&&(h.width=a.width()+"px",y=!0),a.css(h).addClass(p).after(r),"left"!==f&&"right"!==f||r.append(a),a.trigger("sticky_kit:stick"));if(q&&(null==c&&(c=m+l+b>u+k),!n&&c))return n=!0,"static"===d.css("position")&&d.css({position:"relative"}),a.css({position:"absolute",bottom:e,top:""}).trigger("sticky_kit:bottom")},7 -1 s.on("scroll",z),g(document.body).on("sticky_kit:recalc",function(){x();return z()})};k=0;for(B=this.length;k<B;k++)e=this[k],A(g(e));return this}}).call(this);-1 4 (function(){var g,s;g=this.jQuery;s=g(window);g.fn.stick_in_parent=function(e){var t,c,p,A,k,B;null==e&&(e={});p=e.sticky_class;t=e.inner_scrolling;c=e.parent;null==c&&(c=void 0);null==t&&(t=!0);null==p&&(p="is_stuck");A=function(a,e,k,u,x,l){var n,q,f,v,b,d,y,z,r,w;d=a.parent();null!=c&&(d=d.closest(c));if(!d.length)throw"failed to find stick parent";y=function(){var b,f;b=parseInt(d.css("border-top-width"),10);f=parseInt(d.css("padding-top"),10);e=parseInt(d.css("padding-bottom"),10);k=d.offset().top+ -1 5 b+f;u=d.height();x=a.offset().top-parseInt(a.css("margin-top"),10);return l=a.outerHeight(!0)};y();if(l!==u)return f=a.css("float"),r=g("<div />").css({width:a.outerWidth(!0),height:l,display:a.css("display"),"float":f}),n=q=!1,v=void 0,b=0,z=!1,w=function(){var h,g,m,c;m=s.scrollTop();null!=v&&(g=m-v);v=m;q?(c=m+l+b>u+k,n&&!c&&(n=!1,a.css({position:"fixed",bottom:"",top:0}).trigger("sticky_kit:unbottom")),m<x&&(q=!1,b=0,"left"!==f&&"right"!==f||a.insertAfter(r),r.detach(),h={position:""},z&&(h.width= -1 6 ""),a.css(h).removeClass(p).trigger("sticky_kit:unstick")),t&&(h=s.height(),l>h&&!n&&(b-=g,b=Math.max(h-l,b),b=Math.min(0,b),a.css({top:b+"px"})))):m>x&&(q=!0,h={position:"fixed",top:b},"none"===f&&"block"===a.css("display")&&(h.width=a.width()+"px",z=!0),a.css(h).addClass(p).after(r),"left"!==f&&"right"!==f||r.append(a),a.trigger("sticky_kit:stick"));if(q&&(null==c&&(c=m+l+b>u+k),!n&&c))return n=!0,"static"===d.css("position")&&d.css({position:"relative"}),a.css({position:"absolute",bottom:e,top:""}).trigger("sticky_kit:bottom")}, -1 7 s.on("scroll",w),setTimeout(w,0),g(document.body).on("sticky_kit:recalc",function(){y();return w()})};k=0;for(B=this.length;k<B;k++)e=this[k],A(g(e));return this}}).call(this);
diff --git a/site/www/src/jquery.sticky-kit.js b/site/www/src/jquery.sticky-kit.js
@@ -146,6 +146,7 @@ 146 146 } 147 147 }; 148 148 win.on("scroll", tick); -1 149 setTimeout(tick, 0); 149 150 return $(document.body).on("sticky_kit:recalc", function() { 150 151 recalc(); 151 152 return tick();
diff --git a/site/www/src/jquery.sticky-kit.min.js b/site/www/src/jquery.sticky-kit.min.js
@@ -1,7 +1,7 @@ 1 1 /* 2 2 Sticky-kit v0.0.1 | WTFPL | Leaf Corcoran 2013 | http://leafo.net 3 3 */4 -1 (function(){var g,s;g=this.jQuery;s=g(window);g.fn.stick_in_parent=function(e){var t,c,p,A,k,B;null==e&&(e={});p=e.sticky_class;t=e.inner_scrolling;c=e.parent;null==c&&(c=void 0);null==t&&(t=!0);null==p&&(p="is_stuck");A=function(a,e,k,u,w,l){var n,q,f,v,b,d,x,y,r,z;d=a.parent();null!=c&&(d=d.closest(c));if(!d.length)throw"failed to find stick parent";x=function(){var b,f;b=parseInt(d.css("border-top-width"),10);f=parseInt(d.css("padding-top"),10);e=parseInt(d.css("padding-bottom"),10);k=d.offset().top+5 -1 b+f;u=d.height();w=a.offset().top-parseInt(a.css("margin-top"),10);return l=a.outerHeight(!0)};x();if(l!==u)return f=a.css("float"),r=g("<div />").css({width:a.outerWidth(!0),height:l,display:a.css("display"),"float":f}),n=q=!1,v=void 0,b=0,y=!1,z=function(){var h,g,m,c;m=s.scrollTop();null!=v&&(g=m-v);v=m;q?(c=m+l+b>u+k,n&&!c&&(n=!1,a.css({position:"fixed",bottom:"",top:0}).trigger("sticky_kit:unbottom")),m<w&&(q=!1,b=0,"left"!==f&&"right"!==f||a.insertAfter(r),r.detach(),h={position:""},y&&(h.width=6 -1 ""),a.css(h).removeClass(p).trigger("sticky_kit:unstick")),t&&(h=s.height(),l>h&&!n&&(b-=g,b=Math.max(h-l,b),b=Math.min(0,b),a.css({top:b+"px"})))):m>w&&(q=!0,h={position:"fixed",top:b},"none"===f&&"block"===a.css("display")&&(h.width=a.width()+"px",y=!0),a.css(h).addClass(p).after(r),"left"!==f&&"right"!==f||r.append(a),a.trigger("sticky_kit:stick"));if(q&&(null==c&&(c=m+l+b>u+k),!n&&c))return n=!0,"static"===d.css("position")&&d.css({position:"relative"}),a.css({position:"absolute",bottom:e,top:""}).trigger("sticky_kit:bottom")},7 -1 s.on("scroll",z),g(document.body).on("sticky_kit:recalc",function(){x();return z()})};k=0;for(B=this.length;k<B;k++)e=this[k],A(g(e));return this}}).call(this);-1 4 (function(){var g,s;g=this.jQuery;s=g(window);g.fn.stick_in_parent=function(e){var t,c,p,A,k,B;null==e&&(e={});p=e.sticky_class;t=e.inner_scrolling;c=e.parent;null==c&&(c=void 0);null==t&&(t=!0);null==p&&(p="is_stuck");A=function(a,e,k,u,x,l){var n,q,f,v,b,d,y,z,r,w;d=a.parent();null!=c&&(d=d.closest(c));if(!d.length)throw"failed to find stick parent";y=function(){var b,f;b=parseInt(d.css("border-top-width"),10);f=parseInt(d.css("padding-top"),10);e=parseInt(d.css("padding-bottom"),10);k=d.offset().top+ -1 5 b+f;u=d.height();x=a.offset().top-parseInt(a.css("margin-top"),10);return l=a.outerHeight(!0)};y();if(l!==u)return f=a.css("float"),r=g("<div />").css({width:a.outerWidth(!0),height:l,display:a.css("display"),"float":f}),n=q=!1,v=void 0,b=0,z=!1,w=function(){var h,g,m,c;m=s.scrollTop();null!=v&&(g=m-v);v=m;q?(c=m+l+b>u+k,n&&!c&&(n=!1,a.css({position:"fixed",bottom:"",top:0}).trigger("sticky_kit:unbottom")),m<x&&(q=!1,b=0,"left"!==f&&"right"!==f||a.insertAfter(r),r.detach(),h={position:""},z&&(h.width= -1 6 ""),a.css(h).removeClass(p).trigger("sticky_kit:unstick")),t&&(h=s.height(),l>h&&!n&&(b-=g,b=Math.max(h-l,b),b=Math.min(0,b),a.css({top:b+"px"})))):m>x&&(q=!0,h={position:"fixed",top:b},"none"===f&&"block"===a.css("display")&&(h.width=a.width()+"px",z=!0),a.css(h).addClass(p).after(r),"left"!==f&&"right"!==f||r.append(a),a.trigger("sticky_kit:stick"));if(q&&(null==c&&(c=m+l+b>u+k),!n&&c))return n=!0,"static"===d.css("position")&&d.css({position:"relative"}),a.css({position:"absolute",bottom:e,top:""}).trigger("sticky_kit:bottom")}, -1 7 s.on("scroll",w),setTimeout(w,0),g(document.body).on("sticky_kit:recalc",function(){y();return w()})};k=0;for(B=this.length;k<B;k++)e=this[k],A(g(e));return this}}).call(this);