How to add Scrolling Animations

Posted on Mar 18, 2025

by Jimmy

Last updated on April 22, 2026


An easy way to add scrolling animations to a project using the sal.js library.

Step 1

Install the sal.js library: npm install --save sal.js

Step 2

Open main.js and import the Sal.js library:

JavaScript
        
            import sal from 'sal.js';
sal();        
    

Step 3

Enqueue the styles:

PHP
        
            wp_register_style('sal', get_template_directory_uri() . '/node_modules/sal.js/dist/sal.css', [], 1, 'all');
wp_enqueue_style('sal');        
    

Note

You can place this in the scripts() function at the top of the functions.php file

Step 4

Start adding animations to your elements. See their documentation to learn how to do so.


Back to Snippets