Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stickybits

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stickybits - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

2

dist/jquery.stickybits.js

@@ -83,3 +83,3 @@ (function (global, factory) {

function stickiness() {
var scroll = win.scrollY || win.scrollTop;
var scroll = win.scrollY || win.pageYOffset;
var hasStickyClass = classes.contains(stickyClass);

@@ -86,0 +86,0 @@ var hasStuckClass = classes.contains(stuckClass);

/**
* stickybits - Stickybits is a lightweight (~2KB) alternative to `position: sticky` polyfills
* @version v1.3.2
* @version v1.3.3
* @link https://github.com/dollarshaveclub/stickybits#readme
* @author Jeff Wainwright <jjwainwright2@gmail.com>
* @license MIT */
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i():"function"==typeof define&&define.amd?define(i):i()}(0,function(){"use strict";function t(t,i){if("undefined"==typeof window)throw Error("stickybits requires `window`");return this.el=t,this.offset=i&&i.stickyBitStickyOffset||0,this.vp=i&&i.verticalPosition||"top",this.useClasses=i&&i.useStickyClasses||!1,this.styles=this.el.style,this.positionStickyVal="fixed",this.setStickyPosition(),"fixed"!==this.positionStickyVal&&!0!==this.useClasses||this.manageStickiness(),this}function i(t){var i=this;this.privateInstances=t||[],this.cleanup=function(){return i.privateInstances.forEach(function(t){return t.cleanup()})}}function s(s,e){var n="string"==typeof s?document.querySelectorAll(s):s;"length"in n||(n=[n]);for(var o=[],c=0;c<n.length;c+=1){var r=n[c];o.push(new t(r,e))}return new i(o)}if(t.prototype.setStickyPosition=function(){for(var t=["","-o-","-webkit-","-moz-","-ms-"],i=this.styles,s=this.vp,e=0;e<t.length;e+=1)i.position=t[e]+"sticky";return""!==i.position&&(this.positionStickyVal=i.position,"top"===s&&(i[s]=this.offset+"px")),this},t.prototype.manageStickiness=function(){function t(){var t=r.scrollY||r.scrollTop,i=c.contains(a),p=c.contains(l);if(t<f)i&&(c.remove(a),"fixed"===s&&(o.position=""));else if(t>f&&t<h)i||c.add(a),p&&(c.remove(l),o.bottom=""),o.position=s,o[e]=n+"px";else if(t>h&&!p){if(c.remove(a),c.add(l),"fixed"!==s)return;o.top="",o.bottom="0",o.position="absolute"}}var i=this.el.parentNode,s=this.positionStickyVal,e=this.vp,n=this.offset,o=this.styles,c=this.el.classList,r=window;i.classList.add("js-stickybit-parent");var f=this.el.getBoundingClientRect().top,h=f+i.offsetHeight-(this.el.offsetHeight-n),a="js-is-sticky",l="js-is-stuck",p=void 0;return this.checkStickiness=function(){p||(p=!0,r.requestAnimationFrame(t),r.setTimeout(function(){p=!1},0))},r.addEventListener("scroll",this.checkStickiness),this},t.prototype.cleanup=function(){var t=this.el,i=this.styles;i.position="",i[this.vp]="",t.classList.remove("js-is-sticky","js-is-stuck"),t.parentNode.classList.remove("js-stickybit-parent"),window.removeEventListener("scroll",this.checkStickiness),this.checkStickiness=!1},"undefined"!=typeof window){var e=window.$||window.jQuery||window.Zepto;e&&(e.fn.stickybits=function(t){s(this,t)})}});
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i():"function"==typeof define&&define.amd?define(i):i()}(0,function(){"use strict";function t(t,i){if("undefined"==typeof window)throw Error("stickybits requires `window`");return this.el=t,this.offset=i&&i.stickyBitStickyOffset||0,this.vp=i&&i.verticalPosition||"top",this.useClasses=i&&i.useStickyClasses||!1,this.styles=this.el.style,this.positionStickyVal="fixed",this.setStickyPosition(),"fixed"!==this.positionStickyVal&&!0!==this.useClasses||this.manageStickiness(),this}function i(t){var i=this;this.privateInstances=t||[],this.cleanup=function(){return i.privateInstances.forEach(function(t){return t.cleanup()})}}function s(s,e){var n="string"==typeof s?document.querySelectorAll(s):s;"length"in n||(n=[n]);for(var o=[],c=0;c<n.length;c+=1){var r=n[c];o.push(new t(r,e))}return new i(o)}if(t.prototype.setStickyPosition=function(){for(var t=["","-o-","-webkit-","-moz-","-ms-"],i=this.styles,s=this.vp,e=0;e<t.length;e+=1)i.position=t[e]+"sticky";return""!==i.position&&(this.positionStickyVal=i.position,"top"===s&&(i[s]=this.offset+"px")),this},t.prototype.manageStickiness=function(){function t(){var t=r.scrollY||r.pageYOffset,i=c.contains(h),l=c.contains(p);if(t<f)i&&(c.remove(h),"fixed"===s&&(o.position=""));else if(t>f&&t<a)i||c.add(h),l&&(c.remove(p),o.bottom=""),o.position=s,o[e]=n+"px";else if(t>a&&!l){if(c.remove(h),c.add(p),"fixed"!==s)return;o.top="",o.bottom="0",o.position="absolute"}}var i=this.el.parentNode,s=this.positionStickyVal,e=this.vp,n=this.offset,o=this.styles,c=this.el.classList,r=window;i.classList.add("js-stickybit-parent");var f=this.el.getBoundingClientRect().top,a=f+i.offsetHeight-(this.el.offsetHeight-n),h="js-is-sticky",p="js-is-stuck",l=void 0;return this.checkStickiness=function(){l||(l=!0,r.requestAnimationFrame(t),r.setTimeout(function(){l=!1},0))},r.addEventListener("scroll",this.checkStickiness),this},t.prototype.cleanup=function(){var t=this.el,i=this.styles;i.position="",i[this.vp]="",t.classList.remove("js-is-sticky","js-is-stuck"),t.parentNode.classList.remove("js-stickybit-parent"),window.removeEventListener("scroll",this.checkStickiness),this.checkStickiness=!1},"undefined"!=typeof window){var e=window.$||window.jQuery||window.Zepto;e&&(e.fn.stickybits=function(t){s(this,t)})}});

@@ -83,3 +83,3 @@ (function (global, factory) {

function stickiness() {
var scroll = win.scrollY || win.scrollTop;
var scroll = win.scrollY || win.pageYOffset;
var hasStickyClass = classes.contains(stickyClass);

@@ -86,0 +86,0 @@ var hasStuckClass = classes.contains(stuckClass);

/**
* stickybits - Stickybits is a lightweight (~2KB) alternative to `position: sticky` polyfills
* @version v1.3.2
* @version v1.3.3
* @link https://github.com/dollarshaveclub/stickybits#readme
* @author Jeff Wainwright <jjwainwright2@gmail.com>
* @license MIT */
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.stickybits=i()}(this,function(){"use strict";function t(t,i){if("undefined"==typeof window)throw Error("stickybits requires `window`");return this.el=t,this.offset=i&&i.stickyBitStickyOffset||0,this.vp=i&&i.verticalPosition||"top",this.useClasses=i&&i.useStickyClasses||!1,this.styles=this.el.style,this.positionStickyVal="fixed",this.setStickyPosition(),"fixed"!==this.positionStickyVal&&!0!==this.useClasses||this.manageStickiness(),this}function i(t){var i=this;this.privateInstances=t||[],this.cleanup=function(){return i.privateInstances.forEach(function(t){return t.cleanup()})}}function s(s,e){var o="string"==typeof s?document.querySelectorAll(s):s;"length"in o||(o=[o]);for(var n=[],c=0;c<o.length;c+=1){var r=o[c];n.push(new t(r,e))}return new i(n)}return t.prototype.setStickyPosition=function(){for(var t=["","-o-","-webkit-","-moz-","-ms-"],i=this.styles,s=this.vp,e=0;e<t.length;e+=1)i.position=t[e]+"sticky";return""!==i.position&&(this.positionStickyVal=i.position,"top"===s&&(i[s]=this.offset+"px")),this},t.prototype.manageStickiness=function(){function t(){var t=r.scrollY||r.scrollTop,i=c.contains(a),p=c.contains(l);if(t<h)i&&(c.remove(a),"fixed"===s&&(n.position=""));else if(t>h&&t<f)i||c.add(a),p&&(c.remove(l),n.bottom=""),n.position=s,n[e]=o+"px";else if(t>f&&!p){if(c.remove(a),c.add(l),"fixed"!==s)return;n.top="",n.bottom="0",n.position="absolute"}}var i=this.el.parentNode,s=this.positionStickyVal,e=this.vp,o=this.offset,n=this.styles,c=this.el.classList,r=window;i.classList.add("js-stickybit-parent");var h=this.el.getBoundingClientRect().top,f=h+i.offsetHeight-(this.el.offsetHeight-o),a="js-is-sticky",l="js-is-stuck",p=void 0;return this.checkStickiness=function(){p||(p=!0,r.requestAnimationFrame(t),r.setTimeout(function(){p=!1},0))},r.addEventListener("scroll",this.checkStickiness),this},t.prototype.cleanup=function(){var t=this.el,i=this.styles;i.position="",i[this.vp]="",t.classList.remove("js-is-sticky","js-is-stuck"),t.parentNode.classList.remove("js-stickybit-parent"),window.removeEventListener("scroll",this.checkStickiness),this.checkStickiness=!1},s});
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.stickybits=i()}(this,function(){"use strict";function t(t,i){if("undefined"==typeof window)throw Error("stickybits requires `window`");return this.el=t,this.offset=i&&i.stickyBitStickyOffset||0,this.vp=i&&i.verticalPosition||"top",this.useClasses=i&&i.useStickyClasses||!1,this.styles=this.el.style,this.positionStickyVal="fixed",this.setStickyPosition(),"fixed"!==this.positionStickyVal&&!0!==this.useClasses||this.manageStickiness(),this}function i(t){var i=this;this.privateInstances=t||[],this.cleanup=function(){return i.privateInstances.forEach(function(t){return t.cleanup()})}}function s(s,e){var o="string"==typeof s?document.querySelectorAll(s):s;"length"in o||(o=[o]);for(var n=[],c=0;c<o.length;c+=1){var r=o[c];n.push(new t(r,e))}return new i(n)}return t.prototype.setStickyPosition=function(){for(var t=["","-o-","-webkit-","-moz-","-ms-"],i=this.styles,s=this.vp,e=0;e<t.length;e+=1)i.position=t[e]+"sticky";return""!==i.position&&(this.positionStickyVal=i.position,"top"===s&&(i[s]=this.offset+"px")),this},t.prototype.manageStickiness=function(){function t(){var t=r.scrollY||r.pageYOffset,i=c.contains(a),p=c.contains(l);if(t<f)i&&(c.remove(a),"fixed"===s&&(n.position=""));else if(t>f&&t<h)i||c.add(a),p&&(c.remove(l),n.bottom=""),n.position=s,n[e]=o+"px";else if(t>h&&!p){if(c.remove(a),c.add(l),"fixed"!==s)return;n.top="",n.bottom="0",n.position="absolute"}}var i=this.el.parentNode,s=this.positionStickyVal,e=this.vp,o=this.offset,n=this.styles,c=this.el.classList,r=window;i.classList.add("js-stickybit-parent");var f=this.el.getBoundingClientRect().top,h=f+i.offsetHeight-(this.el.offsetHeight-o),a="js-is-sticky",l="js-is-stuck",p=void 0;return this.checkStickiness=function(){p||(p=!0,r.requestAnimationFrame(t),r.setTimeout(function(){p=!1},0))},r.addEventListener("scroll",this.checkStickiness),this},t.prototype.cleanup=function(){var t=this.el,i=this.styles;i.position="",i[this.vp]="",t.classList.remove("js-is-sticky","js-is-stuck"),t.parentNode.classList.remove("js-stickybit-parent"),window.removeEventListener("scroll",this.checkStickiness),this.checkStickiness=!1},s});
{
"name": "stickybits",
"version": "1.3.2",
"version": "1.3.3",
"description": "Stickybits is a lightweight (~2KB) alternative to `position: sticky` polyfills",

@@ -5,0 +5,0 @@ "main": "dist/stickybits.js",

@@ -80,3 +80,3 @@ /*

function stickiness() {
const scroll = win.scrollY || win.scrollTop;
const scroll = win.scrollY || win.pageYOffset;
const hasStickyClass = classes.contains(stickyClass);

@@ -83,0 +83,0 @@ const hasStuckClass = classes.contains(stuckClass);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc