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 2.0.10 to 2.0.13

6

dist/jquery.stickybits.js

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

var o = typeof obj !== 'undefined' ? obj : {};
this.version = '2.0.10';
this.version = '2.0.13';
this.userAgent = window.navigator.userAgent || 'no `userAgent` provided by the browser';

@@ -212,4 +212,4 @@ this.props = {

it.offset = scrollElOffset + p.stickyBitStickyOffset;
it.stickyStart = stickyStart;
it.stickyStop = it.stickyStart + parent.offsetHeight - (it.el.offsetHeight - it.offset);
it.stickyStart = stickyStart - it.offset;
it.stickyStop = stickyStart + parent.offsetHeight - (it.el.offsetHeight + it.offset);
return it;

@@ -216,0 +216,0 @@ };

/**
* stickybits - Stickybits is a lightweight alternative to `position: sticky` polyfills
* @version v2.0.10
* @version v2.0.13
* @link https://github.com/dollarshaveclub/stickybits#readme
* @author Jeff Wainwright <jjwainwright2@gmail.com> (https://jeffry.in)
* @license MIT */
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s():"function"==typeof define&&define.amd?define(s):s()}(0,function(){"use strict";function t(t,s){var e=void 0!==s?s:{};this.version="2.0.10",this.userAgent=window.navigator.userAgent||"no `userAgent` provided by the browser",this.props={noStyles:e.noStyles||!1,stickyBitStickyOffset:e.stickyBitStickyOffset||0,parentClass:e.parentClass||"js-stickybit-parent",scrollEl:e.scrollEl||window,stickyClass:e.stickyClass||"js-is-sticky",stuckClass:e.stuckClass||"js-is-stuck",useStickyClasses:e.useStickyClasses||!1,verticalPosition:e.verticalPosition||"top"};var i=this.props;i.positionVal=this.definePosition()||"fixed";var o=i.verticalPosition,n=i.noStyles,r=i.positionVal;this.els="string"==typeof t?document.querySelectorAll(t):t,"length"in this.els||(this.els=[this.els]),this.instances=[];for(var a=0;a<this.els.length;a+=1){var l=this.els[a],c=l.style;if("top"!==o||n||(c[o]=i.stickyBitStickyOffset+"px"),"fixed"!==r&&!1===i.useStickyClasses)c.position=r;else{"fixed"!==r&&(c.position=r);var p=this.addInstance(l,i);this.instances.push(p)}}return this}function s(s,e){return new t(s,e)}if(t.prototype.definePosition=function(){for(var t=["","-o-","-webkit-","-moz-","-ms-"],s=document.head.style,e=0;e<t.length;e+=1)s.position=t[e]+"sticky";var i="fixed";return void 0!==s.position&&(i=s.position),s.position="",i},t.prototype.addInstance=function(t,s){var e=this,i={el:t,parent:t.parentNode,props:s},o=i.props;i.parent.className+=" "+s.parentClass;var n=o.scrollEl;return i.isWin=n===window,i.isWin||(n=this.getClosestParent(i.el,n)),this.computeScrollOffsets(i),i.state="default",i.stateContainer=function(){e.manageState(i)},n.addEventListener("scroll",i.stateContainer),i},t.prototype.getClosestParent=function(t,s){var e=document.querySelector(s),i=t;if(i.parentElement===e)return e;for(;i.parentElement!==e;)i=i.parentElement;return e},t.prototype.computeScrollOffsets=function(t){var s=t,e=s.props,i=s.parent,o=s.isWin,n=0,r=i.getBoundingClientRect().top;return o||"fixed"!==e.positionVal||(n=e.scrollEl.getBoundingClientRect().top,r=i.getBoundingClientRect().top-n),s.offset=n+e.stickyBitStickyOffset,s.stickyStart=r,s.stickyStop=s.stickyStart+i.offsetHeight-(s.el.offsetHeight-s.offset),s},t.prototype.toggleClasses=function(t,s,e){var i=t,o=i.className.split(" ");e&&-1===o.indexOf(e)&&o.push(e);var n=o.indexOf(s);-1!==n&&o.splice(n,1),i.className=o.join(" ")},t.prototype.manageState=function(t){var s=t,e=s.el,i=s.props,o=s.state,n=s.stickyStart,r=s.stickyStop,a=e.style,l=i.noStyles,c=i.positionVal,p=i.scrollEl,f=i.stickyClass,u=i.stuckClass,y=i.verticalPosition,d=p.requestAnimationFrame;s.isWin&&void 0!==d||(d=function(t){t()});var k=this.toggleClasses,h=s.isWin?p.scrollY||p.pageYOffset:p.scrollTop,v=h>n&&h<r&&("default"===o||"stuck"===o),g=h<=n&&"sticky"===o,C=h>=r&&"sticky"===o;return v?(s.state="sticky",d(function(){k(e,u,f),a.position=c,l||(a.bottom="",a[y]=i.stickyBitStickyOffset+"px")})):g?(s.state="default",d(function(){k(e,f),"fixed"===c&&(a.position="")})):C&&(s.state="stuck",d(function(){k(e,f,u),"fixed"!==c||l||(a.top="",a.bottom="0",a.position="absolute")})),s},t.prototype.removeInstance=function(t){var s=t.el,e=t.props,i=this.toggleClasses;s.style.position="",s.style[e.verticalPosition]="",i(s,e.stickyClass),i(s,e.stuckClass),i(s.parentNode,e.parentClass)},t.prototype.cleanup=function(){for(var t=0;t<this.instances.length;t+=1){var s=this.instances[t];s.props.scrollEl.removeEventListener("scroll",s.stateContainer),this.removeInstance(s)}this.manageState=!1,this.instances=[]},"undefined"!=typeof window){var e=window.$||window.jQuery||window.Zepto;e&&(e.fn.stickybits=function(t){s(this,t)})}});
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s():"function"==typeof define&&define.amd?define(s):s()}(0,function(){"use strict";function t(t,s){var e=void 0!==s?s:{};this.version="2.0.13",this.userAgent=window.navigator.userAgent||"no `userAgent` provided by the browser",this.props={noStyles:e.noStyles||!1,stickyBitStickyOffset:e.stickyBitStickyOffset||0,parentClass:e.parentClass||"js-stickybit-parent",scrollEl:e.scrollEl||window,stickyClass:e.stickyClass||"js-is-sticky",stuckClass:e.stuckClass||"js-is-stuck",useStickyClasses:e.useStickyClasses||!1,verticalPosition:e.verticalPosition||"top"};var i=this.props;i.positionVal=this.definePosition()||"fixed";var o=i.verticalPosition,n=i.noStyles,r=i.positionVal;this.els="string"==typeof t?document.querySelectorAll(t):t,"length"in this.els||(this.els=[this.els]),this.instances=[];for(var a=0;a<this.els.length;a+=1){var l=this.els[a],c=l.style;if("top"!==o||n||(c[o]=i.stickyBitStickyOffset+"px"),"fixed"!==r&&!1===i.useStickyClasses)c.position=r;else{"fixed"!==r&&(c.position=r);var p=this.addInstance(l,i);this.instances.push(p)}}return this}function s(s,e){return new t(s,e)}if(t.prototype.definePosition=function(){for(var t=["","-o-","-webkit-","-moz-","-ms-"],s=document.head.style,e=0;e<t.length;e+=1)s.position=t[e]+"sticky";var i="fixed";return void 0!==s.position&&(i=s.position),s.position="",i},t.prototype.addInstance=function(t,s){var e=this,i={el:t,parent:t.parentNode,props:s},o=i.props;i.parent.className+=" "+s.parentClass;var n=o.scrollEl;return i.isWin=n===window,i.isWin||(n=this.getClosestParent(i.el,n)),this.computeScrollOffsets(i),i.state="default",i.stateContainer=function(){e.manageState(i)},n.addEventListener("scroll",i.stateContainer),i},t.prototype.getClosestParent=function(t,s){var e=document.querySelector(s),i=t;if(i.parentElement===e)return e;for(;i.parentElement!==e;)i=i.parentElement;return e},t.prototype.computeScrollOffsets=function(t){var s=t,e=s.props,i=s.parent,o=s.isWin,n=0,r=i.getBoundingClientRect().top;return o||"fixed"!==e.positionVal||(n=e.scrollEl.getBoundingClientRect().top,r=i.getBoundingClientRect().top-n),s.offset=n+e.stickyBitStickyOffset,s.stickyStart=r-s.offset,s.stickyStop=r+i.offsetHeight-(s.el.offsetHeight+s.offset),s},t.prototype.toggleClasses=function(t,s,e){var i=t,o=i.className.split(" ");e&&-1===o.indexOf(e)&&o.push(e);var n=o.indexOf(s);-1!==n&&o.splice(n,1),i.className=o.join(" ")},t.prototype.manageState=function(t){var s=t,e=s.el,i=s.props,o=s.state,n=s.stickyStart,r=s.stickyStop,a=e.style,l=i.noStyles,c=i.positionVal,p=i.scrollEl,f=i.stickyClass,u=i.stuckClass,y=i.verticalPosition,d=p.requestAnimationFrame;s.isWin&&void 0!==d||(d=function(t){t()});var h=this.toggleClasses,k=s.isWin?p.scrollY||p.pageYOffset:p.scrollTop,v=k>n&&k<r&&("default"===o||"stuck"===o),g=k<=n&&"sticky"===o,C=k>=r&&"sticky"===o;return v?(s.state="sticky",d(function(){h(e,u,f),a.position=c,l||(a.bottom="",a[y]=i.stickyBitStickyOffset+"px")})):g?(s.state="default",d(function(){h(e,f),"fixed"===c&&(a.position="")})):C&&(s.state="stuck",d(function(){h(e,f,u),"fixed"!==c||l||(a.top="",a.bottom="0",a.position="absolute")})),s},t.prototype.removeInstance=function(t){var s=t.el,e=t.props,i=this.toggleClasses;s.style.position="",s.style[e.verticalPosition]="",i(s,e.stickyClass),i(s,e.stuckClass),i(s.parentNode,e.parentClass)},t.prototype.cleanup=function(){for(var t=0;t<this.instances.length;t+=1){var s=this.instances[t];s.props.scrollEl.removeEventListener("scroll",s.stateContainer),this.removeInstance(s)}this.manageState=!1,this.instances=[]},"undefined"!=typeof window){var e=window.$||window.jQuery||window.Zepto;e&&(e.fn.stickybits=function(t){s(this,t)})}});

@@ -55,3 +55,3 @@ /*

var o = typeof obj !== 'undefined' ? obj : {};
this.version = '2.0.10';
this.version = '2.0.13';
this.userAgent = window.navigator.userAgent || 'no `userAgent` provided by the browser';

@@ -206,4 +206,4 @@ this.props = {

it.offset = scrollElOffset + p.stickyBitStickyOffset;
it.stickyStart = stickyStart;
it.stickyStop = it.stickyStart + parent.offsetHeight - (it.el.offsetHeight - it.offset);
it.stickyStart = stickyStart - it.offset;
it.stickyStop = stickyStart + parent.offsetHeight - (it.el.offsetHeight + it.offset);
return it;

@@ -210,0 +210,0 @@ };

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

var o = typeof obj !== 'undefined' ? obj : {};
this.version = '2.0.10';
this.version = '2.0.13';
this.userAgent = window.navigator.userAgent || 'no `userAgent` provided by the browser';

@@ -212,4 +212,4 @@ this.props = {

it.offset = scrollElOffset + p.stickyBitStickyOffset;
it.stickyStart = stickyStart;
it.stickyStop = it.stickyStart + parent.offsetHeight - (it.el.offsetHeight - it.offset);
it.stickyStart = stickyStart - it.offset;
it.stickyStop = stickyStart + parent.offsetHeight - (it.el.offsetHeight + it.offset);
return it;

@@ -216,0 +216,0 @@ };

/**
* stickybits - Stickybits is a lightweight alternative to `position: sticky` polyfills
* @version v2.0.10
* @version v2.0.13
* @link https://github.com/dollarshaveclub/stickybits#readme
* @author Jeff Wainwright <jjwainwright2@gmail.com> (https://jeffry.in)
* @license MIT */
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):t.stickybits=s()}(this,function(){"use strict";function t(t,s){var e=void 0!==s?s:{};this.version="2.0.10",this.userAgent=window.navigator.userAgent||"no `userAgent` provided by the browser",this.props={noStyles:e.noStyles||!1,stickyBitStickyOffset:e.stickyBitStickyOffset||0,parentClass:e.parentClass||"js-stickybit-parent",scrollEl:e.scrollEl||window,stickyClass:e.stickyClass||"js-is-sticky",stuckClass:e.stuckClass||"js-is-stuck",useStickyClasses:e.useStickyClasses||!1,verticalPosition:e.verticalPosition||"top"};var i=this.props;i.positionVal=this.definePosition()||"fixed";var o=i.verticalPosition,n=i.noStyles,r=i.positionVal;this.els="string"==typeof t?document.querySelectorAll(t):t,"length"in this.els||(this.els=[this.els]),this.instances=[];for(var a=0;a<this.els.length;a+=1){var l=this.els[a],c=l.style;if("top"!==o||n||(c[o]=i.stickyBitStickyOffset+"px"),"fixed"!==r&&!1===i.useStickyClasses)c.position=r;else{"fixed"!==r&&(c.position=r);var p=this.addInstance(l,i);this.instances.push(p)}}return this}return t.prototype.definePosition=function(){for(var t=["","-o-","-webkit-","-moz-","-ms-"],s=document.head.style,e=0;e<t.length;e+=1)s.position=t[e]+"sticky";var i="fixed";return void 0!==s.position&&(i=s.position),s.position="",i},t.prototype.addInstance=function(t,s){var e=this,i={el:t,parent:t.parentNode,props:s},o=i.props;i.parent.className+=" "+s.parentClass;var n=o.scrollEl;return i.isWin=n===window,i.isWin||(n=this.getClosestParent(i.el,n)),this.computeScrollOffsets(i),i.state="default",i.stateContainer=function(){e.manageState(i)},n.addEventListener("scroll",i.stateContainer),i},t.prototype.getClosestParent=function(t,s){var e=document.querySelector(s),i=t;if(i.parentElement===e)return e;for(;i.parentElement!==e;)i=i.parentElement;return e},t.prototype.computeScrollOffsets=function(t){var s=t,e=s.props,i=s.parent,o=s.isWin,n=0,r=i.getBoundingClientRect().top;return o||"fixed"!==e.positionVal||(n=e.scrollEl.getBoundingClientRect().top,r=i.getBoundingClientRect().top-n),s.offset=n+e.stickyBitStickyOffset,s.stickyStart=r,s.stickyStop=s.stickyStart+i.offsetHeight-(s.el.offsetHeight-s.offset),s},t.prototype.toggleClasses=function(t,s,e){var i=t,o=i.className.split(" ");e&&-1===o.indexOf(e)&&o.push(e);var n=o.indexOf(s);-1!==n&&o.splice(n,1),i.className=o.join(" ")},t.prototype.manageState=function(t){var s=t,e=s.el,i=s.props,o=s.state,n=s.stickyStart,r=s.stickyStop,a=e.style,l=i.noStyles,c=i.positionVal,p=i.scrollEl,f=i.stickyClass,u=i.stuckClass,y=i.verticalPosition,d=p.requestAnimationFrame;s.isWin&&void 0!==d||(d=function(t){t()});var k=this.toggleClasses,h=s.isWin?p.scrollY||p.pageYOffset:p.scrollTop,v=h>n&&h<r&&("default"===o||"stuck"===o),g=h<=n&&"sticky"===o,m=h>=r&&"sticky"===o;return v?(s.state="sticky",d(function(){k(e,u,f),a.position=c,l||(a.bottom="",a[y]=i.stickyBitStickyOffset+"px")})):g?(s.state="default",d(function(){k(e,f),"fixed"===c&&(a.position="")})):m&&(s.state="stuck",d(function(){k(e,f,u),"fixed"!==c||l||(a.top="",a.bottom="0",a.position="absolute")})),s},t.prototype.removeInstance=function(t){var s=t.el,e=t.props,i=this.toggleClasses;s.style.position="",s.style[e.verticalPosition]="",i(s,e.stickyClass),i(s,e.stuckClass),i(s.parentNode,e.parentClass)},t.prototype.cleanup=function(){for(var t=0;t<this.instances.length;t+=1){var s=this.instances[t];s.props.scrollEl.removeEventListener("scroll",s.stateContainer),this.removeInstance(s)}this.manageState=!1,this.instances=[]},function(s,e){return new t(s,e)}});
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):t.stickybits=s()}(this,function(){"use strict";function t(t,s){var e=void 0!==s?s:{};this.version="2.0.13",this.userAgent=window.navigator.userAgent||"no `userAgent` provided by the browser",this.props={noStyles:e.noStyles||!1,stickyBitStickyOffset:e.stickyBitStickyOffset||0,parentClass:e.parentClass||"js-stickybit-parent",scrollEl:e.scrollEl||window,stickyClass:e.stickyClass||"js-is-sticky",stuckClass:e.stuckClass||"js-is-stuck",useStickyClasses:e.useStickyClasses||!1,verticalPosition:e.verticalPosition||"top"};var i=this.props;i.positionVal=this.definePosition()||"fixed";var o=i.verticalPosition,n=i.noStyles,r=i.positionVal;this.els="string"==typeof t?document.querySelectorAll(t):t,"length"in this.els||(this.els=[this.els]),this.instances=[];for(var a=0;a<this.els.length;a+=1){var l=this.els[a],c=l.style;if("top"!==o||n||(c[o]=i.stickyBitStickyOffset+"px"),"fixed"!==r&&!1===i.useStickyClasses)c.position=r;else{"fixed"!==r&&(c.position=r);var p=this.addInstance(l,i);this.instances.push(p)}}return this}return t.prototype.definePosition=function(){for(var t=["","-o-","-webkit-","-moz-","-ms-"],s=document.head.style,e=0;e<t.length;e+=1)s.position=t[e]+"sticky";var i="fixed";return void 0!==s.position&&(i=s.position),s.position="",i},t.prototype.addInstance=function(t,s){var e=this,i={el:t,parent:t.parentNode,props:s},o=i.props;i.parent.className+=" "+s.parentClass;var n=o.scrollEl;return i.isWin=n===window,i.isWin||(n=this.getClosestParent(i.el,n)),this.computeScrollOffsets(i),i.state="default",i.stateContainer=function(){e.manageState(i)},n.addEventListener("scroll",i.stateContainer),i},t.prototype.getClosestParent=function(t,s){var e=document.querySelector(s),i=t;if(i.parentElement===e)return e;for(;i.parentElement!==e;)i=i.parentElement;return e},t.prototype.computeScrollOffsets=function(t){var s=t,e=s.props,i=s.parent,o=s.isWin,n=0,r=i.getBoundingClientRect().top;return o||"fixed"!==e.positionVal||(n=e.scrollEl.getBoundingClientRect().top,r=i.getBoundingClientRect().top-n),s.offset=n+e.stickyBitStickyOffset,s.stickyStart=r-s.offset,s.stickyStop=r+i.offsetHeight-(s.el.offsetHeight+s.offset),s},t.prototype.toggleClasses=function(t,s,e){var i=t,o=i.className.split(" ");e&&-1===o.indexOf(e)&&o.push(e);var n=o.indexOf(s);-1!==n&&o.splice(n,1),i.className=o.join(" ")},t.prototype.manageState=function(t){var s=t,e=s.el,i=s.props,o=s.state,n=s.stickyStart,r=s.stickyStop,a=e.style,l=i.noStyles,c=i.positionVal,p=i.scrollEl,f=i.stickyClass,u=i.stuckClass,y=i.verticalPosition,d=p.requestAnimationFrame;s.isWin&&void 0!==d||(d=function(t){t()});var h=this.toggleClasses,k=s.isWin?p.scrollY||p.pageYOffset:p.scrollTop,v=k>n&&k<r&&("default"===o||"stuck"===o),g=k<=n&&"sticky"===o,m=k>=r&&"sticky"===o;return v?(s.state="sticky",d(function(){h(e,u,f),a.position=c,l||(a.bottom="",a[y]=i.stickyBitStickyOffset+"px")})):g?(s.state="default",d(function(){h(e,f),"fixed"===c&&(a.position="")})):m&&(s.state="stuck",d(function(){h(e,f,u),"fixed"!==c||l||(a.top="",a.bottom="0",a.position="absolute")})),s},t.prototype.removeInstance=function(t){var s=t.el,e=t.props,i=this.toggleClasses;s.style.position="",s.style[e.verticalPosition]="",i(s,e.stickyClass),i(s,e.stuckClass),i(s.parentNode,e.parentClass)},t.prototype.cleanup=function(){for(var t=0;t<this.instances.length;t+=1){var s=this.instances[t];s.props.scrollEl.removeEventListener("scroll",s.stateContainer),this.removeInstance(s)}this.manageState=!1,this.instances=[]},function(s,e){return new t(s,e)}});
{
"name": "stickybits",
"version": "2.0.10",
"version": "2.0.13",
"description": "Stickybits is a lightweight alternative to `position: sticky` polyfills",

@@ -16,3 +16,3 @@ "main": "dist/stickybits.js",

"report:coverage": "nyc report --reporter=lcov > coverage.lcov && codecov",
"test:es-check": "es-check check es5 dist/stickybits.min.js dist/stickybits.js dist/jquery.stickybits.js dist/jquery.stickybits.min.js",
"test:es-check": "es-check es5 dist/stickybits.min.js dist/stickybits.js dist/jquery.stickybits.js dist/jquery.stickybits.min.js",
"test:unit": "nyc jest --coverage",

@@ -56,3 +56,3 @@ "test:acceptance": "gulp test --coverage",

"debug": "^3.0.0",
"es-check": "^1.0.0",
"es-check": "^2.0.0",
"eslint": "^4.1.0",

@@ -75,3 +75,3 @@ "eslint-config-airbnb": "^16.0.0",

"qunit": "^2.4.1",
"rollup": "0.50.1",
"rollup": "0.52.1",
"rollup-plugin-babel": "^3.0.0",

@@ -78,0 +78,0 @@ "rollup-plugin-commonjs": "^8.0.2",

@@ -58,11 +58,11 @@ <p align="center">

```sh
yarn add stickybits --dev
yarn add stickybits
```
npm
```sh
npm i stickybits --save-dev
npm i stickybits
```
bower
```sh
bower i stickybits --save-dev
bower i stickybits
```

@@ -104,6 +104,6 @@

```css
.some-sticky-element .js-is-sticky {
.some-sticky-element.js-is-sticky {
background-color: red;
}
.some-sticky-element .js-is-stuck {
.some-sticky-element.js-is-stuck {
background-color: green;

@@ -291,3 +291,3 @@ }

For more debugging and managing Stickbits, view the [wiki]](https://github.com/dollarshaveclub/stickybits/wiki).
For more debugging and managing Stickbits, view the [wiki](https://github.com/dollarshaveclub/stickybits/wiki).

@@ -294,0 +294,0 @@ ---

@@ -202,4 +202,4 @@ /*

it.offset = scrollElOffset + p.stickyBitStickyOffset
it.stickyStart = stickyStart
it.stickyStop = (it.stickyStart + parent.offsetHeight) - (it.el.offsetHeight - it.offset)
it.stickyStart = stickyStart - it.offset
it.stickyStop = (stickyStart + parent.offsetHeight) - (it.el.offsetHeight + it.offset)
return it

@@ -206,0 +206,0 @@ }

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