explaingit

mciastek/sal

Analysis updated 2026-07-03

3,692HTMLAudience · developerComplexity · 1/5LicenseSetup · easy

TLDR

A tiny 2.8KB JavaScript library that animates webpage elements as visitors scroll, with no dependencies, 11 animation types, and low CPU usage via the browser's Intersection Observer API.

Mindmap

mindmap
  root((sal))
    What it does
      Scroll animations
      Viewport detection
      Custom event firing
    Animations
      Fade
      Slide four directions
      Zoom
      Flip
    Tech Stack
      JavaScript
      Intersection Observer
      CSS custom properties
    Features
      No dependencies
      2.8KB size
      Repeat control
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add fade-in, slide-up, or zoom-in animations to landing page sections as visitors scroll down to them.

USE CASE 2

Animate any HTML element on scroll without adding jQuery or any other library to your project.

USE CASE 3

Fire custom JavaScript events when a specific section scrolls into view to trigger additional page logic.

What is it built with?

JavaScriptCSSHTML

How does it compare?

mciastek/saltc39/proposal-temporaltwitter/scala_school
Stars3,6923,6933,696
LanguageHTMLHTMLHTML
Setup difficultyeasyeasyeasy
Complexity1/52/51/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min
Use freely for any purpose, including commercial projects, as long as you keep the copyright notice.

In plain English

Sal (short for Scroll Animation Library) is a small JavaScript library that makes elements on a webpage animate as visitors scroll down to see them. The entire library weighs less than 2.8 kilobytes and has no outside dependencies, meaning you add one file and a stylesheet to your project and it is ready to use. The setup is minimal. You add a data attribute to any HTML element you want to animate, specify which animation type to use (such as fade, slide-up, or zoom-in), and call the library once in your script. It then watches the page and triggers the chosen animation whenever that element scrolls into view. Eleven animation types are available: fade, four slide directions, two zoom directions, and four flip directions. You can fine-tune each animation using additional data attributes: one controls duration (from 200 to 2000 milliseconds), another adds a delay before the animation starts, and a third controls the motion curve. CSS custom properties can be used as an alternative if you prefer to manage these values from a stylesheet rather than inline attributes. By default, each animation plays once. You can change this globally so animations repeat every time an element enters and exits view, or override the behavior on individual elements. The library also fires events when elements enter or leave the viewport, so you can attach your own code to react to those moments. Under the hood, Sal uses the browser's Intersection Observer API rather than scroll event listeners, which keeps CPU usage low even on pages with many animated elements. It is released under the MIT license.

Copy-paste prompts

Prompt 1
Set up Sal.js to fade in my hero section and slide up my feature cards as users scroll down the page.
Prompt 2
How do I configure Sal.js so animations replay every time an element enters the viewport instead of playing just once?
Prompt 3
Write code using Sal.js to trigger a custom JavaScript callback when a specific div scrolls into view.
Prompt 4
What data attributes does Sal.js support for controlling animation type, duration, and delay on individual elements?
Prompt 5
How do I use CSS custom properties with Sal.js to control animation timing from a stylesheet instead of inline attributes?

Frequently asked questions

What is sal?

A tiny 2.8KB JavaScript library that animates webpage elements as visitors scroll, with no dependencies, 11 animation types, and low CPU usage via the browser's Intersection Observer API.

What language is sal written in?

Mainly HTML. The stack also includes JavaScript, CSS, HTML.

What license does sal use?

Use freely for any purpose, including commercial projects, as long as you keep the copyright notice.

How hard is sal to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is sal for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub mciastek on gitmyhub

Verify against the repo before relying on details.