Viewing File: /home/maglabs/bambinos/wp-content/plugins/novaworks/public/element/js/lib/jquery.sticky.min.js

!function(w){function i(t,o){function i(t,o,s){var e={},i=t[0].style;s.forEach(function(t){e[t]="left"!==t&&void 0!==i[t]?i[t]:""}),t.data("css-backup-"+o,e)}function r(t,o){return t.data("css-backup-"+o)}function s(){i(p,"unsticky",["position","width","margin-top","margin-bottom","top","bottom"]);var t={position:"fixed",width:k(p,"width"),marginTop:0,marginBottom:0};t[l.to]=l.offset,t["top"===l.to?"bottom":"top"]="";var o=p.offset().left;t.left=o,p.css(t).addClass(l.classes.stickyActive)}function e(){p.css(r(p,"unsticky")).css("left","").removeClass(l.classes.stickyActive)}function n(t){var o=y.$window.scrollTop(),s=k(t,"height"),e=innerHeight;return{top:{fromTop:o=t.offset().top-o,fromBottom:e=o-e},bottom:{fromTop:o+s,fromBottom:e+s}}}function c(){y.$spacer=p.clone().addClass(l.classes.spacer).css({visibility:"hidden",transition:"none",animation:"none"}),p.after(y.$spacer),s(),m=!0,p.trigger("sticky:stick")}function a(){e(),y.$spacer.remove(),m=!1,p.trigger("sticky:unstick")}function f(){var t,o,s=n(p),e="top"===l.to;d?(e?s.top.fromTop>l.offset:s.bottom.fromBottom<-l.offset)&&(y.$parent.css(r(y.$parent,"childNotFollowing")),p.css(r(p,"notFollowing")).css("left",""),d=!1):(t=n(y.$parent),o=getComputedStyle(y.$parent[0]),o=parseFloat(o[e?"borderBottomWidth":"borderTopWidth"]),o=e?t.bottom.fromTop-o:t.top.fromBottom+o,(e?o<=s.bottom.fromTop:o>=s.top.fromBottom)&&function(){i(y.$parent,"childNotFollowing",["position"]),y.$parent.css("position","relative"),i(p,"notFollowing",["position","top","bottom"]);var t={position:"absolute"};t[l.to]="",t["top"===l.to?"bottom":"top"]=0,p.css(t).css("left",""),d=!0}())}var p,l,m=!1,d=!1,u=!1,y={},h=(w("body").hasClass("rtl"),{to:"top",offset:0,effectsOffset:0,parent:!1,classes:{sticky:"sticky",stickyActive:"sticky-active",stickyEffects:"sticky-effects",spacer:"sticky-spacer"}}),k=function(t,o,s){var e=getComputedStyle(t[0]),i=parseFloat(e[o]),r="height"===o?["top","bottom"]:["left","right"],o=[];return"border-box"!==e.boxSizing&&o.push("border","padding"),s&&o.push("margin"),o.forEach(function(o){r.forEach(function(t){i+=parseFloat(e[o+"-"+t])})}),i},v=function(){var t,o,s=l.offset;m?(t=n(y.$spacer),o="top"===l.to?t.top.fromTop-s:-t.bottom.fromBottom-s,l.parent&&f(),0<o&&a()):(t=n(p),(o="top"===l.to?t.top.fromTop-s:-t.bottom.fromBottom-s)<=0&&(c(),l.parent&&f())),o=o,u&&-o<l.effectsOffset?(p.removeClass(l.classes.stickyEffects),u=!1):!u&&-o>=l.effectsOffset&&(p.addClass(l.classes.stickyEffects),u=!0)},b=function(){v()},g=function(){m&&(e(),s(),l.parent&&(d=!1,f()))};this.destroy=function(){m&&a(),y.$window.off("scroll",b).off("resize",g),p.removeClass(l.classes.sticky)},l=jQuery.extend(!0,h,o),p=w(t).addClass(l.classes.sticky),y.$window=w(window),l.parent&&("parent"===l.parent?y.$parent=p.parent():y.$parent=p.closest(l.parent)),y.$window.on({scroll:b,resize:g}),v()}w.fn.sticky=function(s){var e="string"==typeof s;return this.each(function(){var t=w(this);if(e){var o=t.data("sticky");if(!o)throw Error("Trying to perform the `"+s+"` method prior to initialization");if(!o[s])throw ReferenceError("Method `"+s+"` not found in sticky instance");o[s].apply(o,Array.prototype.slice.call(arguments,1)),"destroy"===s&&t.removeData("sticky")}else t.data("sticky",new i(this,s))}),this},window.Sticky=i}(jQuery);
Back to Directory File Manager