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.2.4 to 1.2.5

12

dist/jquery.stickybits.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
typeof define === 'function' && define.amd ? define(factory) :
(factory());
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
typeof define === 'function' && define.amd ? define(factory) :
(factory());
}(this, (function () { 'use strict';
var positionStickyVal = 'fixed';
var browserPrefix = ['', '-o-', '-webkit-', '-moz-', '-ms-'];

@@ -19,2 +18,3 @@ var stickyBitClass = 'js-is-sticky';

this.elStyle = this.el.style;
this.positionStickyVal = 'fixed';
}

@@ -29,3 +29,3 @@

if (elStyle.position !== '') {
positionStickyVal = elStyle.position;
this.positionStickyVal = elStyle.position;
if (verticalPosition === 'top') {

@@ -40,2 +40,3 @@ elStyle[verticalPosition] = this.stickyBitStickyOffset + 'px';

var scrollTarget = this.scrollTarget;
var positionStickyVal = this.positionStickyVal;
var verticalPosition = this.verticalPosition;

@@ -95,2 +96,3 @@ var stickyBitStickyOffset = this.stickyBitStickyOffset;

stickyBit.setStickyPosition();
console.log(stickyBit.positionStickyVal);
if (stickyBit.positionStickyVal === 'fixed' || stickyBit.useStickyClasses === true) {

@@ -97,0 +99,0 @@ stickyBit.manageStickiness();

@@ -7,2 +7,2 @@ /**

* @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){this.el=t,this.scrollTarget=i&&i.scrollTarget||window,this.stickyBitStickyOffset=i&&i.stickyBitStickyOffset||0,this.verticalPosition=i&&i.verticalPosition||"top",this.useStickyClasses=i&&i.useStickyClasses||!1,this.elStyle=this.el.style}function i(i,e){var s="string"==typeof i?document.querySelectorAll(i):i;"length"in s||(s=[s]);for(var o=void 0,n=0;n<s.length;n+=1){o=new t(s[n],e),o.setStickyPosition(),"fixed"!==o.positionStickyVal&&o.useStickyClasses!==!0||o.manageStickiness()}}var e="fixed",s=["","-o-","-webkit-","-moz-","-ms-"],o="js-is-sticky",n="js-is-stuck";if(t.prototype.setStickyPosition=function(){for(var t=this.elStyle,i=this.verticalPosition,o=0;o<s.length;o+=1)t.position=s[o]+"sticky";""!==t.position&&(e=t.position,"top"===i&&(t[i]=this.stickyBitStickyOffset+"px"))},t.prototype.manageStickiness=function(){function t(){var t=c.scrollY;if(t<y)a.contains(o)&&(a.remove(o),l.position="");else if(t>y&&t<u)a.contains(o)||a.add(o),a.contains(n)&&(a.remove(n),l.bottom=""),l.position=e,l[f]=r+"px";else if(t>u&&!a.contains(n)){if(a.remove(o),a.add(n),"fixed"!==e)return;l.top="",l.bottom="0",l.position="absolute"}}function i(){p||(p=!0,t(),window.setTimeout(function(){p=!1},0))}var s=this.el,c=this.scrollTarget,f=this.verticalPosition,r=this.stickyBitStickyOffset,l=this.elStyle,a=s.classList,d=s.parentNode,y=s.getBoundingClientRect().top,u=y+d.offsetHeight-s.offsetHeight;d.classList.add("js-stickybit-parent");var p=void 0;c.addEventListener("scroll",function(){return c.requestAnimationFrame(i)})},"undefined"!=typeof window){var c=window.$||window.jQuery||window.Zepto;c&&(c.fn.stickybits=function(t){i(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){this.el=t,this.scrollTarget=i&&i.scrollTarget||window,this.stickyBitStickyOffset=i&&i.stickyBitStickyOffset||0,this.verticalPosition=i&&i.verticalPosition||"top",this.useStickyClasses=i&&i.useStickyClasses||!1,this.elStyle=this.el.style,this.positionStickyVal="fixed"}function i(i,o){var s="string"==typeof i?document.querySelectorAll(i):i;"length"in s||(s=[s]);for(var e=void 0,n=0;n<s.length;n+=1){e=new t(s[n],o),e.setStickyPosition(),console.log(e.positionStickyVal),"fixed"!==e.positionStickyVal&&!0!==e.useStickyClasses||e.manageStickiness()}}var o=["","-o-","-webkit-","-moz-","-ms-"],s="js-is-sticky",e="js-is-stuck";if(t.prototype.setStickyPosition=function(){for(var t=this.elStyle,i=this.verticalPosition,s=0;s<o.length;s+=1)t.position=o[s]+"sticky";""!==t.position&&(this.positionStickyVal=t.position,"top"===i&&(t[i]=this.stickyBitStickyOffset+"px"))},t.prototype.manageStickiness=function(){function t(){var t=n.scrollY;if(t<d)r.contains(s)&&(r.remove(s),a.position="");else if(t>d&&t<p)r.contains(s)||r.add(s),r.contains(e)&&(r.remove(e),a.bottom=""),a.position=c,a[l]=f+"px";else if(t>p&&!r.contains(e)){if(r.remove(s),r.add(e),"fixed"!==c)return;a.top="",a.bottom="0",a.position="absolute"}}function i(){u||(u=!0,t(),window.setTimeout(function(){u=!1},0))}var o=this.el,n=this.scrollTarget,c=this.positionStickyVal,l=this.verticalPosition,f=this.stickyBitStickyOffset,a=this.elStyle,r=o.classList,y=o.parentNode,d=o.getBoundingClientRect().top,p=d+y.offsetHeight-o.offsetHeight;y.classList.add("js-stickybit-parent");var u=void 0;n.addEventListener("scroll",function(){return n.requestAnimationFrame(i)})},"undefined"!=typeof window){var n=window.$||window.jQuery||window.Zepto;n&&(n.fn.stickybits=function(t){i(this,t)})}});
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.stickybits = factory());
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.stickybits = factory());
}(this, (function () { 'use strict';
var positionStickyVal = 'fixed';
var browserPrefix = ['', '-o-', '-webkit-', '-moz-', '-ms-'];

@@ -19,2 +18,3 @@ var stickyBitClass = 'js-is-sticky';

this.elStyle = this.el.style;
this.positionStickyVal = 'fixed';
}

@@ -29,3 +29,3 @@

if (elStyle.position !== '') {
positionStickyVal = elStyle.position;
this.positionStickyVal = elStyle.position;
if (verticalPosition === 'top') {

@@ -40,2 +40,3 @@ elStyle[verticalPosition] = this.stickyBitStickyOffset + 'px';

var scrollTarget = this.scrollTarget;
var positionStickyVal = this.positionStickyVal;
var verticalPosition = this.verticalPosition;

@@ -95,2 +96,3 @@ var stickyBitStickyOffset = this.stickyBitStickyOffset;

stickyBit.setStickyPosition();
console.log(stickyBit.positionStickyVal);
if (stickyBit.positionStickyVal === 'fixed' || stickyBit.useStickyClasses === true) {

@@ -97,0 +99,0 @@ stickyBit.manageStickiness();

@@ -7,2 +7,2 @@ /**

* @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){this.el=t,this.scrollTarget=i&&i.scrollTarget||window,this.stickyBitStickyOffset=i&&i.stickyBitStickyOffset||0,this.verticalPosition=i&&i.verticalPosition||"top",this.useStickyClasses=i&&i.useStickyClasses||!1,this.elStyle=this.el.style}function i(i,e){var s="string"==typeof i?document.querySelectorAll(i):i;"length"in s||(s=[s]);for(var o=void 0,n=0;n<s.length;n+=1){o=new t(s[n],e),o.setStickyPosition(),"fixed"!==o.positionStickyVal&&o.useStickyClasses!==!0||o.manageStickiness()}}var e="fixed",s=["","-o-","-webkit-","-moz-","-ms-"],o="js-is-sticky",n="js-is-stuck";return t.prototype.setStickyPosition=function(){for(var t=this.elStyle,i=this.verticalPosition,o=0;o<s.length;o+=1)t.position=s[o]+"sticky";""!==t.position&&(e=t.position,"top"===i&&(t[i]=this.stickyBitStickyOffset+"px"))},t.prototype.manageStickiness=function(){function t(){var t=c.scrollY;if(t<u)a.contains(o)&&(a.remove(o),f.position="");else if(t>u&&t<d)a.contains(o)||a.add(o),a.contains(n)&&(a.remove(n),f.bottom=""),f.position=e,f[r]=l+"px";else if(t>d&&!a.contains(n)){if(a.remove(o),a.add(n),"fixed"!==e)return;f.top="",f.bottom="0",f.position="absolute"}}function i(){p||(p=!0,t(),window.setTimeout(function(){p=!1},0))}var s=this.el,c=this.scrollTarget,r=this.verticalPosition,l=this.stickyBitStickyOffset,f=this.elStyle,a=s.classList,y=s.parentNode,u=s.getBoundingClientRect().top,d=u+y.offsetHeight-s.offsetHeight;y.classList.add("js-stickybit-parent");var p=void 0;c.addEventListener("scroll",function(){return c.requestAnimationFrame(i)})},i});
!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){this.el=t,this.scrollTarget=i&&i.scrollTarget||window,this.stickyBitStickyOffset=i&&i.stickyBitStickyOffset||0,this.verticalPosition=i&&i.verticalPosition||"top",this.useStickyClasses=i&&i.useStickyClasses||!1,this.elStyle=this.el.style,this.positionStickyVal="fixed"}function i(i,s){var e="string"==typeof i?document.querySelectorAll(i):i;"length"in e||(e=[e]);for(var o=void 0,n=0;n<e.length;n+=1){o=new t(e[n],s),o.setStickyPosition(),console.log(o.positionStickyVal),"fixed"!==o.positionStickyVal&&!0!==o.useStickyClasses||o.manageStickiness()}}var s=["","-o-","-webkit-","-moz-","-ms-"],e="js-is-sticky",o="js-is-stuck";return t.prototype.setStickyPosition=function(){for(var t=this.elStyle,i=this.verticalPosition,e=0;e<s.length;e+=1)t.position=s[e]+"sticky";""!==t.position&&(this.positionStickyVal=t.position,"top"===i&&(t[i]=this.stickyBitStickyOffset+"px"))},t.prototype.manageStickiness=function(){function t(){var t=n.scrollY;if(t<p)f.contains(e)&&(f.remove(e),a.position="");else if(t>p&&t<u)f.contains(e)||f.add(e),f.contains(o)&&(f.remove(o),a.bottom=""),a.position=c,a[l]=r+"px";else if(t>u&&!f.contains(o)){if(f.remove(e),f.add(o),"fixed"!==c)return;a.top="",a.bottom="0",a.position="absolute"}}function i(){d||(d=!0,t(),window.setTimeout(function(){d=!1},0))}var s=this.el,n=this.scrollTarget,c=this.positionStickyVal,l=this.verticalPosition,r=this.stickyBitStickyOffset,a=this.elStyle,f=s.classList,y=s.parentNode,p=s.getBoundingClientRect().top,u=p+y.offsetHeight-s.offsetHeight;y.classList.add("js-stickybit-parent");var d=void 0;n.addEventListener("scroll",function(){return n.requestAnimationFrame(i)})},i});
{
"name": "stickybits",
"version": "1.2.4",
"version": "1.2.5",
"description": "Stickybits is a lightweight (<2KB) alternative to `position: sticky` polyfills",

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

@@ -1,2 +0,1 @@

let positionStickyVal = 'fixed';
const browserPrefix = ['', '-o-', '-webkit-', '-moz-', '-ms-'];

@@ -13,2 +12,3 @@ const stickyBitClass = 'js-is-sticky';

this.elStyle = this.el.style;
this.positionStickyVal = 'fixed';
}

@@ -23,3 +23,3 @@

if (elStyle.position !== '') {
positionStickyVal = elStyle.position;
this.positionStickyVal = elStyle.position;
if (verticalPosition === 'top') {

@@ -34,2 +34,3 @@ elStyle[verticalPosition] = `${this.stickyBitStickyOffset}px`;

const scrollTarget = this.scrollTarget;
const positionStickyVal = this.positionStickyVal;
const verticalPosition = this.verticalPosition;

@@ -36,0 +37,0 @@ const stickyBitStickyOffset = this.stickyBitStickyOffset;

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