Movatterモバイル変換


[0]ホーム

URL:


tiny-sticky

1.1.2 • Public • Published

Tiny sticky

implace the sticky without css sticky, can use to set single element to sticky, also can set one element to sticky in some area element.

Run demo

  1. Install dependencies
npm install
  1. Run dev
npm start
  1. Build
npm run build

Browser adapting

usegetBoundingClientRect to check element is at the screen window, andcan I use link of getBoundingClientRect;

And compiled with babel, so it can be used on at most 99% browsers.

Usages

import{stickyInArea,singleSticky}from'tiny-sticky';conststickySelfEle=document.querySelector('.nav');conststickyInAreaEle=document.querySelector('.nav.right');conststickyAreaElement=document.querySelector('.main');singleSticky(stickySelfEle);stickyInArea(stickyInAreaEle,stickyAreaElement);

Params

singleSticky(stickyElement:HtmlElement,scrollElement:HtmlElement|window,offset:number|0);stickyInArea(stickyElement:HtmlElement,stickyAreaElement:HtmlElement,scrollEle:HtmlElement|window,offset:number|0);

Readme

Keywords

Package Sidebar

Install

npm i tiny-sticky

Weekly Downloads

8

Version

1.1.2

License

ISC

Unpacked Size

8.28 kB

Total Files

6

Last publish

Collaborators

  • markzzw

[8]ページ先頭

©2009-2025 Movatter.jp