@silen/sticky
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

sticky

Sticky is a lightweight alternative to position: sticky polyfills

install

npm i @silen/sticky

usage

import Sticky from '@silen/sticky';

const selector: string | Element = '.child';
const option: {
  customStickyChangeNumber?: number | null;
  noStyles?: boolean;
  stickyBitStickyOffset?: number;
  parentClass?: string;
  scrollContainer?: Element | string | Window;
  stickyClass?: string;
  stuckClass?: string;
  stickyChangeClass?: string;
  useStickyClasses?: boolean;
  useFixed?: boolean;
  useGetBoundingClientRect?: boolean;
  verticalPosition?: 'top' | 'bottom';
  applyStyle?: Function;
} = { scrollContainer: document.querySelector('.container') };

const sticky = new Sticky(selector, option);

more examples

Package Sidebar

Install

npm i @silen/sticky

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

77.2 kB

Total Files

17

Last publish

Collaborators

  • silentsun