stickybits
Advanced tools
Comparing version 2.0.13 to 2.1.1
@@ -7,7 +7,22 @@ # Changelog | ||
## [UNRELEASED] | ||
## [2.0.15] - [2.0.7] - 2017-06-17 | ||
### Changed | ||
> Sorry if this is incorrect. I'm not update to date on changelogs. | ||
### Updated | ||
- Updated K. Vanberendonck's Github username. ([282f622](https://github.com/dollarshaveclub/stickybits/commit/282f62265628a1b47f4a51cc5cdd13f6b3981422)) | ||
- Updated dependencies _things_. | ||
- chore(package): update rollup to version 0.52.1 (#170) | ||
- chore(package): update rollup to version 0.52.0 (#163) | ||
- chore(package): update rollup to version 0.51.8 (#158) | ||
- chore(package): update rollup to version 0.51.6 (#157) | ||
### Fixed | ||
- Fixed offset issue. | ||
- Rosivanov master (#164) | ||
### Added | ||
- Added Module | ||
- Add "module" property (#147) | ||
## [2.0.6] - 2017-10-17 | ||
@@ -14,0 +29,0 @@ |
@@ -61,3 +61,3 @@ (function (global, factory) { | ||
var o = typeof obj !== 'undefined' ? obj : {}; | ||
this.version = '2.0.13'; | ||
this.version = '2.1.1'; | ||
this.userAgent = window.navigator.userAgent || 'no `userAgent` provided by the browser'; | ||
@@ -94,9 +94,9 @@ this.props = { | ||
styles.position = pv; | ||
} else { | ||
} else if (pv !== 'fixed') { | ||
// const stickyManager = new ManageSticky(el, p) | ||
if (pv !== 'fixed') styles.position = pv; | ||
var instance = this.addInstance(el, p); | ||
// instances are an array of objects | ||
this.instances.push(instance); | ||
styles.position = pv; | ||
} | ||
var instance = this.addInstance(el, p); | ||
// instances are an array of objects | ||
this.instances.push(instance); | ||
} | ||
@@ -213,4 +213,9 @@ return this; | ||
it.offset = scrollElOffset + p.stickyBitStickyOffset; | ||
it.stickyStart = stickyStart - it.offset; | ||
it.stickyStop = stickyStart + parent.offsetHeight - (it.el.offsetHeight + it.offset); | ||
if (p.verticalPosition !== 'bottom') { | ||
it.stickyStart = stickyStart - it.offset; | ||
it.stickyStop = stickyStart + parent.offsetHeight - (it.el.offsetHeight + it.offset); | ||
} else { | ||
it.stickyStart = 0; | ||
it.stickyStop = stickyStart + parent.offsetHeight; | ||
} | ||
return it; | ||
@@ -217,0 +222,0 @@ }; |
/** | ||
* stickybits - Stickybits is a lightweight alternative to `position: sticky` polyfills | ||
* @version v2.0.13 | ||
* @version v2.1.1 | ||
* @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.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)})}}); | ||
!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.1.1",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;"top"!==o||n||(c[o]=i.stickyBitStickyOffset+"px"),"fixed"!==r&&!1===i.useStickyClasses?c.position=r:"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,"bottom"!==e.verticalPosition?(s.stickyStart=r-s.offset,s.stickyStop=r+i.offsetHeight-(s.el.offsetHeight+s.offset)):(s.stickyStart=0,s.stickyStop=r+i.offsetHeight),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=[]},"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.13'; | ||
this.version = '2.1.1'; | ||
this.userAgent = window.navigator.userAgent || 'no `userAgent` provided by the browser'; | ||
@@ -88,9 +88,9 @@ this.props = { | ||
styles.position = pv; | ||
} else { | ||
} else if (pv !== 'fixed') { | ||
// const stickyManager = new ManageSticky(el, p) | ||
if (pv !== 'fixed') styles.position = pv; | ||
var instance = this.addInstance(el, p); | ||
// instances are an array of objects | ||
this.instances.push(instance); | ||
styles.position = pv; | ||
} | ||
var instance = this.addInstance(el, p); | ||
// instances are an array of objects | ||
this.instances.push(instance); | ||
} | ||
@@ -207,4 +207,9 @@ return this; | ||
it.offset = scrollElOffset + p.stickyBitStickyOffset; | ||
it.stickyStart = stickyStart - it.offset; | ||
it.stickyStop = stickyStart + parent.offsetHeight - (it.el.offsetHeight + it.offset); | ||
if (p.verticalPosition !== 'bottom') { | ||
it.stickyStart = stickyStart - it.offset; | ||
it.stickyStop = stickyStart + parent.offsetHeight - (it.el.offsetHeight + it.offset); | ||
} else { | ||
it.stickyStart = 0; | ||
it.stickyStop = stickyStart + parent.offsetHeight; | ||
} | ||
return it; | ||
@@ -211,0 +216,0 @@ }; |
@@ -61,3 +61,3 @@ (function (global, factory) { | ||
var o = typeof obj !== 'undefined' ? obj : {}; | ||
this.version = '2.0.13'; | ||
this.version = '2.1.1'; | ||
this.userAgent = window.navigator.userAgent || 'no `userAgent` provided by the browser'; | ||
@@ -94,9 +94,9 @@ this.props = { | ||
styles.position = pv; | ||
} else { | ||
} else if (pv !== 'fixed') { | ||
// const stickyManager = new ManageSticky(el, p) | ||
if (pv !== 'fixed') styles.position = pv; | ||
var instance = this.addInstance(el, p); | ||
// instances are an array of objects | ||
this.instances.push(instance); | ||
styles.position = pv; | ||
} | ||
var instance = this.addInstance(el, p); | ||
// instances are an array of objects | ||
this.instances.push(instance); | ||
} | ||
@@ -213,4 +213,9 @@ return this; | ||
it.offset = scrollElOffset + p.stickyBitStickyOffset; | ||
it.stickyStart = stickyStart - it.offset; | ||
it.stickyStop = stickyStart + parent.offsetHeight - (it.el.offsetHeight + it.offset); | ||
if (p.verticalPosition !== 'bottom') { | ||
it.stickyStart = stickyStart - it.offset; | ||
it.stickyStop = stickyStart + parent.offsetHeight - (it.el.offsetHeight + it.offset); | ||
} else { | ||
it.stickyStart = 0; | ||
it.stickyStop = stickyStart + parent.offsetHeight; | ||
} | ||
return it; | ||
@@ -217,0 +222,0 @@ }; |
/** | ||
* stickybits - Stickybits is a lightweight alternative to `position: sticky` polyfills | ||
* @version v2.0.13 | ||
* @version v2.1.1 | ||
* @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.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)}}); | ||
!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.1.1",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;"top"!==o||n||(c[o]=i.stickyBitStickyOffset+"px"),"fixed"!==r&&!1===i.useStickyClasses?c.position=r:"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,"bottom"!==e.verticalPosition?(s.stickyStart=r-s.offset,s.stickyStop=r+i.offsetHeight-(s.el.offsetHeight+s.offset)):(s.stickyStart=0,s.stickyStop=r+i.offsetHeight),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)}}); |
{ | ||
"name": "stickybits", | ||
"version": "2.0.13", | ||
"version": "2.1.1", | ||
"description": "Stickybits is a lightweight alternative to `position: sticky` polyfills", | ||
@@ -67,13 +67,13 @@ "main": "dist/stickybits.js", | ||
"gulp-uglify": "^3.0.0", | ||
"jest": "^21.0.1", | ||
"jest": "^22.0.0", | ||
"jquery": "^3.2.1", | ||
"node-qunit-phantomjs": "^1.5.0", | ||
"node-qunit-phantomjs": "^2.0.0", | ||
"nyc": "^11.2.1", | ||
"pre-commit": "^1.2.2", | ||
"qunit": "^2.4.1", | ||
"rollup": "0.52.1", | ||
"rollup": "0.53.4", | ||
"rollup-plugin-babel": "^3.0.0", | ||
"rollup-plugin-commonjs": "^8.0.2", | ||
"rollup-plugin-eslint": "^4.0.0", | ||
"rollup-plugin-node-resolve": "^2.0.0" | ||
"rollup-plugin-node-resolve": "^3.0.1" | ||
}, | ||
@@ -80,0 +80,0 @@ "keywords": [ |
@@ -58,3 +58,3 @@ <p align="center"> | ||
```sh | ||
yarn add stickybits | ||
yarn add stickybits | ||
``` | ||
@@ -67,3 +67,3 @@ npm | ||
```sh | ||
bower i stickybits | ||
bower i stickybits --save | ||
``` | ||
@@ -325,3 +325,3 @@ | ||
Created and maintained by [Jeff Wainwright](https://github.com/yowainwright) with [Dollar Shave Club Engineering](https://github.com/dollarshaveclub). | ||
[Created](https://github.com/yowainwright/sticky-bits) and maintained by [Jeff Wainwright](https://github.com/yowainwright) with [Dollar Shave Club Engineering](https://github.com/dollarshaveclub). | ||
@@ -87,9 +87,9 @@ /* | ||
styles.position = pv | ||
} else { | ||
} else if (pv !== 'fixed') { | ||
// const stickyManager = new ManageSticky(el, p) | ||
if (pv !== 'fixed') styles.position = pv | ||
const instance = this.addInstance(el, p) | ||
// instances are an array of objects | ||
this.instances.push(instance) | ||
styles.position = pv | ||
} | ||
const instance = this.addInstance(el, p) | ||
// instances are an array of objects | ||
this.instances.push(instance) | ||
} | ||
@@ -203,4 +203,9 @@ return this | ||
it.offset = scrollElOffset + p.stickyBitStickyOffset | ||
it.stickyStart = stickyStart - it.offset | ||
it.stickyStop = (stickyStart + parent.offsetHeight) - (it.el.offsetHeight + it.offset) | ||
if (p.verticalPosition !== 'bottom') { | ||
it.stickyStart = stickyStart - it.offset | ||
it.stickyStop = (stickyStart + parent.offsetHeight) - (it.el.offsetHeight + it.offset) | ||
} else { | ||
it.stickyStart = 0 | ||
it.stickyStop = stickyStart + parent.offsetHeight | ||
} | ||
return it | ||
@@ -207,0 +212,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68208
1417