Steady.js

A jank-free module to do logic on the onscroll event without performance regressions in @media-query like conditions.

Get Started Install Star on Github

How does it work?

Steady's main goal is to make the user scrolling jank-free. Below is an explaination on how Steady is working under the hood:

  1. First, Steady attaches a handler to the onscroll event, that excutes the trackers (collecting numbers only).
  2. Then it calls another function that checks the conditions with values inside a requestAnimationFrame to avoid making the onscroll handler fat and slow, which will jank our scrolling.
  3. After that check, the function tries to see if the conditions are met. If they're met, it calls the handler with the values and the done function, otherwise it does nothing.
  4. When the handler is called, Steady stops collecting values until the done callback is called by the handler. This will help you when you do async stuff.

Features

Instance methods

Steady (options)

Options:

Basic usage

Custom trackers

Scrollable element

Stop/Resume

Demo

Install

NPM

$ npm install steady

Bower

$ bower install Steady.js

Download

You can download the latest release from the github repo

Changelog

2.0.0

1.0.0

By Khalid Lafi / @LafiKL