PageSourceSearch

https://www.getagardener.co.uk/wp-content/themes/wordpress-theme-w…/js/jquery.sticky-kit.min.js?ver=v2025.1.0

js getagardener.co.uk collected 2026-10-08 19:15:47 UTC 7,526 bytes, 242 lines download raw bytes

vendor: 7,526 bytes, lines 1-242
1// Generated by CoffeeScript 1.7.1
2
3/**
4@license Sticky-kit v1.1.1 | WTFPL | Leaf Corcoran 2014 | http://leafo.net
5 */
6
7(function() {
8  var $, win;
9
10  $ = this.jQuery || window.jQuery;
11
12  win = $(window);
13
14  $.fn.stick_in_parent = function(opts) {
15    var elm, enable_bottoming, inner_scrolling, manual_spacer, offset_top, parent_selector, recalc_every, sticky_class, _fn, _i, _len;
16    if (opts == null) {
17      opts = {};
18    }
19    sticky_class = opts.sticky_class, inner_scrolling = opts.inner_scrolling, recalc_every = opts.recalc_every, parent_selector = opts.parent, offset_top = opts.offset_top, manual_spacer = opts.spacer, enable_bottoming = opts.bottoming;
20    if (offset_top == null) {
21      offset_top = 80;
22    }
23    if (parent_selector == null) {
24      parent_selector = void 0;
25    }
26    if (inner_scrolling == null) {
27      inner_scrolling = true;
28    }
29    if (sticky_class == null) {
30      sticky_class = "is_stuck";
31    }
32    if (enable_bottoming == null) {
33      enable_bottoming = true;
34    }
35    _fn = function(elm, padding_bottom, parent_top, parent_height, top, height, el_float, detached) {
36      var bottomed, detach, fixed, last_pos, offset, parent, recalc, recalc_and_tick, recalc_counter, spacer, tick;
37      if (elm.data("sticky_kit")) {
38        return;
39      }
40      elm.data("sticky_kit", true);
41      parent = elm.parent();
42      if (parent_selector != null) {
43        parent = parent.closest(parent_selector);
44      }
45      if (!parent.length) {
46        throw "failed to find stick parent";
47      }
48      fixed = false;
49      bottomed = false;
50      spacer = manual_spacer != null ? manual_spacer && elm.closest(manual_spacer) : $("<div />");
51      if (spacer) {
52        spacer.css('position', elm.css('position'));
53      }
54      recalc = function() {
55        var border_top, padding_top, restore;
56        if (detached) {
57          return;
58        }
59        border_top = parseInt(parent.css("border-top-width"), 10);
60        padding_top = parseInt(parent.css("padding-top"), 10);
61        padding_bottom = parseInt(parent.css("padding-bottom"), 10);
62        parent_top = parent.offset().top + border_top + padding_top;
63        parent_height = parent.height();
64        if (fixed) {
65          fixed = false;
66          bottomed = false;
67          if (manual_spacer == null) {
68            elm.insertAfter(spacer);
69            spacer.detach();
70          }
71          elm.css({
72            position: "",
73            top: "",
74            width: "",
75            bottom: ""
76          }).removeClass(sticky_class);
77          restore = true;
78        }
79        top = elm.offset().top - parseInt(elm.css("margin-top"), 10) - offset_top;
80        height = elm.outerHeight(true);
81        el_float = elm.css("float");
82        if (spacer) {
83          spacer.css({
84            width: elm.outerWidth(true),
85            height: height,
86            display: elm.css("display"),
87            "vertical-align": elm.css("vertical-align"),
88            "float": el_float
89          });
90        }
91        if (restore) {
92          return tick();
93        }
94      };
95      recalc();
96      if (height === parent_height) {
97        return;
98      }
99      last_pos = void 0;
100      offset = offset_top;
101      recalc_counter = recalc_every;
102      tick = function() {
103        var css, delta, scroll, will_bottom, win_height;
104        if (detached) {
105          return;
106        }
107        if (recalc_counter != null) {
108          recalc_counter -= 1;
109          if (recalc_counter <= 0) {
110            recalc_counter = recalc_every;
111            recalc();
112          }
113        }
114        scroll = win.scrollTop();
115        if (last_pos != null) {
116          delta = scroll - last_pos;
117        }
118        last_pos = scroll;
119        if (fixed) {
120          if (enable_bottoming) {
121            will_bottom = scroll + height + offset > parent_height + parent_top;
122            if (bottomed && !will_bottom) {
123              bottomed = false;
124              elm.css({
125                position: "fixed",
126                bottom: "",
127                top: offset
128              }).trigger("sticky_kit:unbottom");
129            }
130          }
131          if (scroll < top) {
132            fixed = false;
133            offset = offset_top;
134            if (manual_spacer == null) {
135              if (el_float === "left" || el_float === "right") {
136                elm.insertAfter(spacer);
137              }
138              spacer.detach();
139            }
140            css = {
141              position: "",
142              width: "",
143              top: ""
144            };
145            elm.css(css).removeClass(sticky_class).trigger("sticky_kit:unstick");
146          }
147          if (inner_scrolling) {
148            win_height = win.height();
149            if (height + offset_top > win_height) {
150              if (!bottomed) {
151                offset -= delta;
152                offset = Math.max(win_height - height, offset);
153                offset = Math.min(offset_top, offset);
154                if (fixed) {
155                  elm.css({
156                    top: offset + "px"
157                  });
158                }
159              }
160            }
161          }
162        } else {
163          if (scroll > top) {
164            fixed = true;
165            css = {
166              position: "fixed",
167              top: offset
168            };
169            css.width = elm.css("box-sizing") === "border-box" ? elm.outerWidth() + "px" : elm.width() + "px";
170            elm.css(css).addClass(sticky_class);
171            if (manual_spacer == null) {
172              elm.after(spacer);
173              if (el_float === "left" || el_float === "right") {
174                spacer.append(elm);
175              }
176            }
177            elm.trigger("sticky_kit:stick");
178          }
179        }
180        if (fixed && enable_bottoming) {
181          if (will_bottom == null) {
182            will_bottom = scroll + height + offset > parent_height + parent_top;
183          }
184          if (!bottomed && will_bottom) {
185            bottomed = true;
186            if (parent.css("position") === "static") {
187              parent.css({
188                position: "relative"
189              });
190            }
191            return elm.css({
192              position: "absolute",
193              bottom: padding_bottom,
194              top: "auto"
195            }).trigger("sticky_kit:bottom");
196          }
197        }
198      };
199      recalc_and_tick = function() {
200        recalc();
201        return tick();
202      };
203      detach = function() {
204        detached = true;
205        win.off("touchmove", tick);
206        win.off("scroll", tick);
207        win.off("resize", recalc_and_tick);
208        $(document.body).off("sticky_kit:recalc", recalc_and_tick);
209        elm.off("sticky_kit:detach", detach);
210        elm.removeData("sticky_kit");
211        elm.css({
212          position: "",
213          bottom: "",
214          top: "",
215          width: ""
216        });
217        parent.position("position", "");
218        if (fixed) {
219          if (manual_spacer == null) {
220            if (el_float === "left" || el_float === "right") {
221              elm.insertAfter(spacer);
222            }
223            spacer.remove();
224          }
225          return elm.removeClass(sticky_class);
226        }
227      };
228      win.on("touchmove", tick);
229      win.on("scroll", tick);
230      win.on("resize", recalc_and_tick);
231      $(document.body).on("sticky_kit:recalc", recalc_and_tick);
232      elm.on("sticky_kit:detach", detach);
233      return setTimeout(tick, 0);
234    };
235    for (_i = 0, _len = this.length; _i < _len; _i++) {
236      elm = this[_i];
237      _fn($(elm));
238    }
239    return this;
240  };
241
242}).call(this);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.