Code Monkey home page Code Monkey logo

scroll-timeline-polyfill's Introduction

Scroll Timeline Base Polyfill

A TypeScript rewrite of a scroll-timeline-base.js polyfill.

Note

All features except the ScrollTimeline class itself have been removed from this polyfill to reduce the final bundle size as much as possible (esm min ~2.41kb).

So this is just a JS base polyfill for scrolling in browsers that currently don't have built-in Scroll Timeline API.

Usage

import { ScrollTimeline } from './dist/scroll-timeline-base.mjs'

// Start timeline
const timeline = new ScrollTimeline()

// Cancel timeline
timeline.cancel()

Options

const timeline = new ScrollTimeline({
  source: document.documentElement,
  axis: 'y',
})

source

  • Type: HTMLElement | null | undefined
  • Default: document.documentElement

axis

  • Type: 'y' | 'x' | undefined
  • Default: 'y'

Formats

  • ESM, IIFE, UMD

Bundle size

i Individual stats per module
i ├─ ./dist/scroll-timeline-base.mjs         esm │  54ms │ 5.13 KB
i ├─ ./dist/scroll-timeline-base.min.mjs     esm │  21ms │ 2.41 KB
i ├─ ./dist/scroll-timeline-base.iife.js    iife │  19ms │ 2.46 KB
i ├─ ./dist/scroll-timeline-base.umd.js      umd │  14ms │ 2.63 KB
i ├─ ./dist/types.d.ts                       dts │ 773ms │  1020 B

License

Released under the Apache-2.0 license.

scroll-timeline-polyfill's People

Contributors

ivodolenc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.