relatively-sticky

A jQuery plugin for creating smart sticky elements
git clone https://git.ce9e.org/relatively-sticky.git

commit
e1c3b3577be8c4a4dbb9dd4a502a3c40ef7823d5
parent
7d23add51cb1a2186d2fb23bf00b28fb3a52b049
Author
leaf corcoran <leafot@gmail.com>
Date
2014-01-08 02:25
don't use float as variable name fixes #24

Diffstat

M jquery.sticky-kit.coffee 10 +++++-----
M jquery.sticky-kit.js 13 ++++++-------

2 files changed, 11 insertions, 12 deletions


diff --git a/jquery.sticky-kit.coffee b/jquery.sticky-kit.coffee

@@ -13,7 +13,7 @@ $.fn.stick_in_parent = (opts={}) ->
   13    13   sticky_class ?= "is_stuck"
   14    14 
   15    15   for elm in @
   16    -1     ((elm, padding_bottom, parent_top, parent_height, top, height, float) ->
   -1    16     ((elm, padding_bottom, parent_top, parent_height, top, height, el_float) ->
   17    17       return if elm.data "sticky_kit"
   18    18       elm.data "sticky_kit", true
   19    19 
@@ -46,13 +46,13 @@ $.fn.stick_in_parent = (opts={}) ->
   46    46 
   47    47         height = elm.outerHeight true
   48    48 
   49    -1         float = elm.css "float"
   -1    49         el_float = elm.css "float"
   50    50         spacer.css({
   51    51           width: elm.outerWidth true
   52    52           height: height
   53    53           display: elm.css "display"
   54    54           "vertical-align": elm.css "vertical-align"
   55    -1           float: float
   -1    55           float: el_float
   56    56         })
   57    57 
   58    58         if restore
@@ -88,7 +88,7 @@ $.fn.stick_in_parent = (opts={}) ->
   88    88             fixed = false
   89    89             offset = offset_top
   90    90 
   91    -1             if float == "left" || float == "right"
   -1    91             if el_float == "left" || el_float == "right"
   92    92               elm.insertAfter spacer
   93    93 
   94    94             spacer.detach()
@@ -126,7 +126,7 @@ $.fn.stick_in_parent = (opts={}) ->
  126   126 
  127   127             elm.css(css).addClass(sticky_class).after(spacer)
  128   128 
  129    -1             if float == "left" || float == "right"
   -1   129             if el_float == "left" || el_float == "right"
  130   130               spacer.append elm
  131   131 
  132   132             elm.trigger("sticky_kit:stick")

diff --git a/jquery.sticky-kit.js b/jquery.sticky-kit.js

@@ -1,5 +1,4 @@
    1    -1 // Generated by CoffeeScript 1.4.0
    2    -1 
   -1     1 // Generated by CoffeeScript 1.6.3
    3     2 /**
    4     3 @license Sticky-kit v1.0.2 | WTFPL | Leaf Corcoran 2013 | http://leafo.net
    5     4 */
@@ -30,7 +29,7 @@
   30    29     if (sticky_class == null) {
   31    30       sticky_class = "is_stuck";
   32    31     }
   33    -1     _fn = function(elm, padding_bottom, parent_top, parent_height, top, height, float) {
   -1    32     _fn = function(elm, padding_bottom, parent_top, parent_height, top, height, el_float) {
   34    33       var bottomed, detach, fixed, last_pos, offset, parent, recalc, recalc_and_tick, spacer, tick;
   35    34       if (elm.data("sticky_kit")) {
   36    35         return;
@@ -59,13 +58,13 @@
   59    58         }), spacer.detach(), true) : void 0;
   60    59         top = elm.offset().top - parseInt(elm.css("margin-top"), 10) - offset_top;
   61    60         height = elm.outerHeight(true);
   62    -1         float = elm.css("float");
   -1    61         el_float = elm.css("float");
   63    62         spacer.css({
   64    63           width: elm.outerWidth(true),
   65    64           height: height,
   66    65           display: elm.css("display"),
   67    66           "vertical-align": elm.css("vertical-align"),
   68    -1           float: float
   -1    67           float: el_float
   69    68         });
   70    69         if (restore) {
   71    70           return tick();
@@ -98,7 +97,7 @@
   98    97           if (scroll < top) {
   99    98             fixed = false;
  100    99             offset = offset_top;
  101    -1             if (float === "left" || float === "right") {
   -1   100             if (el_float === "left" || el_float === "right") {
  102   101               elm.insertAfter(spacer);
  103   102             }
  104   103             spacer.detach();
@@ -133,7 +132,7 @@
  133   132             };
  134   133             css.width = elm.width() + "px";
  135   134             elm.css(css).addClass(sticky_class).after(spacer);
  136    -1             if (float === "left" || float === "right") {
   -1   135             if (el_float === "left" || el_float === "right") {
  137   136               spacer.append(elm);
  138   137             }
  139   138             elm.trigger("sticky_kit:stick");