momentum

Track movement and basic events with CSS custom properties

Downloads
8
Stars
19

Momentum

Add page events like tracking scroll position, mouse position, device orientation, and more to your CSS! See an example of momentum in use.

Installation

Add the js inside your <head> tag.

Usage

All values are unitless meaning you will need to add your units to them. For example, calc(var(--scrolly)*1px) results in a pixel value for the vertical scroll position.

Global variables

Element variables

To trigger element variables, add the class momentumcss to your elemnt.