JSPM

  • Created
  • Published
  • Downloads 73552
  • Score
    100M100P100Q162529F
  • License MIT

Smooth Scroll behavior polyfill

Package Exports

  • seamless-scroll-polyfill
  • seamless-scroll-polyfill/lib/browser.min.js
  • seamless-scroll-polyfill/lib/browser.min.js.map
  • seamless-scroll-polyfill/lib/bundle.umd.cjs
  • seamless-scroll-polyfill/lib/bundle.umd.cjs.map
  • seamless-scroll-polyfill/lib/common.d.ts
  • seamless-scroll-polyfill/lib/common.d.ts.map
  • seamless-scroll-polyfill/lib/common.js
  • seamless-scroll-polyfill/lib/common.js.map
  • seamless-scroll-polyfill/lib/index.cjs
  • seamless-scroll-polyfill/lib/index.cjs.map
  • seamless-scroll-polyfill/lib/index.d.cts
  • seamless-scroll-polyfill/lib/index.d.ts
  • seamless-scroll-polyfill/lib/index.d.ts.map
  • seamless-scroll-polyfill/lib/index.js
  • seamless-scroll-polyfill/lib/index.js.map
  • seamless-scroll-polyfill/lib/polyfill.d.ts
  • seamless-scroll-polyfill/lib/polyfill.d.ts.map
  • seamless-scroll-polyfill/lib/polyfill.js
  • seamless-scroll-polyfill/lib/polyfill.js.map
  • seamless-scroll-polyfill/lib/scroll-end-event.d.ts
  • seamless-scroll-polyfill/lib/scroll-end-event.d.ts.map
  • seamless-scroll-polyfill/lib/scroll-end-event.js
  • seamless-scroll-polyfill/lib/scroll-end-event.js.map
  • seamless-scroll-polyfill/lib/scroll-step.d.ts
  • seamless-scroll-polyfill/lib/scroll-step.d.ts.map
  • seamless-scroll-polyfill/lib/scroll-step.js
  • seamless-scroll-polyfill/lib/scroll-step.js.map
  • seamless-scroll-polyfill/lib/scroll.d.ts
  • seamless-scroll-polyfill/lib/scroll.d.ts.map
  • seamless-scroll-polyfill/lib/scroll.js
  • seamless-scroll-polyfill/lib/scroll.js.map
  • seamless-scroll-polyfill/lib/scroll.polyfill.d.ts
  • seamless-scroll-polyfill/lib/scroll.polyfill.d.ts.map
  • seamless-scroll-polyfill/lib/scroll.polyfill.js
  • seamless-scroll-polyfill/lib/scroll.polyfill.js.map
  • seamless-scroll-polyfill/lib/scrollIntoView.d.ts
  • seamless-scroll-polyfill/lib/scrollIntoView.d.ts.map
  • seamless-scroll-polyfill/lib/scrollIntoView.js
  • seamless-scroll-polyfill/lib/scrollIntoView.js.map
  • seamless-scroll-polyfill/lib/scrollIntoView.polyfill.d.ts
  • seamless-scroll-polyfill/lib/scrollIntoView.polyfill.d.ts.map
  • seamless-scroll-polyfill/lib/scrollIntoView.polyfill.js
  • seamless-scroll-polyfill/lib/scrollIntoView.polyfill.js.map
  • seamless-scroll-polyfill/package.json

Readme

Build Status

This repo is forked from iamdustan/smoothscroll and rewritten with TypeScript.

Installation and use

# npm
npm install seamless-scroll-polyfill --save

# yarn
yarn add seamless-scroll-polyfill

Use polyfill to patch all methods

import { polyfill } from "seamless-scroll-polyfill";

polyfill();

Use specific polyfill

import { elementScrollIntoViewPolyfill } from "seamless-scroll-polyfill";

elementScrollIntoViewPolyfill();

Use methods directly without patching

import { scrollIntoView } from "seamless-scroll-polyfill";

scrollIntoView(document.querySelector("#target"), { behavior: "smooth", block: "center", inline: "center" });

Import via script

<!-- please replace the `latest` with specific version -->
<script src="https://cdn.jsdelivr.net/npm/seamless-scroll-polyfill@latest"></script>
<script>
    // patch all methods
    seamless.polyfill();
    // or use specific methods
    seamless.scrollBy(window, { behavior: "smooth", top: 200, left: 0 });

    seamless.scrollIntoView(document.querySelector("#target"), {
        behavior: "smooth",
        block: "center",
        inline: "center",
    });
</script>

Changelog

Detailed changes for each release are documented in CHANGELOG.md.

Thanks