A Tiny JavaScript Library to Enable CSS Animation When The User Scrolls | onscroll-effect

On Scroll Effect, a JavaScript library with a scroll effect that automatically adds or removes CSS classes from a specific element when you scroll down/up a web page.

This library switches a class to an item when it appears in the viewport when the user scrolls. It allows you to create CSS transitions or animations that only play when the user hovers over them. Only set some HTML themes, and code the rest using your CSS skills.

How to make use of it:

Install & download.

$ npm install onscroll-effect --save

Import the onscroll-effect.

import "onscroll-effect";

Include the ‘onscroll-effect.min.js’ script on the bottom of the webpage.

<script src="/dist/onscroll-effect.es6.min.js"></script>

Add the ‘data-scroll’ attribute to the target component.

<div data-scroll> 
  Element To Animate

By default, the library routinely adds the class ‘.is-outside’ to the component when it’s outside of the viewport.

.is-outside::before {
  transform: translateY(10em);

You’re allowed to make use of a customized CSS class as an alternative of  ‘.is-outside’.

<div data-scroll="your own class"> 
  Element To Animate

Determine whether or not to repeat the animation.

<div data-scroll="your own class"
     Element To Animate

<div data-scroll="your own class"
     Element To Animate

Set the gap from the top to trigger the animation.

<div data-scroll="your own class"
     Element To Animate

Remove the CSS class as an alternative when the component is outside of the viewport. Defaults to ‘is-inside’.

<div data-scroll="your own class"
     Element To Animate

animate div on scroll, on scroll animation, on scroll effect Plugin/Github

See Demo And Download

Official Website(Twikito): Click Here

This superior jQuery/javascript plugin is developed by Twikito. For extra Advanced Usages, please go to the official website.

Related Posts


Confetti Falling Animation Effect In JavaScript | party.js

Party.js is a JavaScript library to brighten user site experience with visual effects! Celebrate success with dom confetti! The library is written in TypeScript and compiled into…


Simple jQuery Cookie Consent Plugin

jquery.cookie-consent is a simple jQuery plugin to request consent to use cookies. An easy-to-use and highly customizable cookie consent bar that informs your visitors of the use…


Timepicker JavaScript Plugin for jQuery Inspired by Google Calendar

jquery.timepicker is a lightweight jQuery timer plugin inspired by Google Calendar. It supports both mouse and keyboard navigation and weighs 5.5KB minified and compact. Features: Highly customizable…


A Lightweight, Touchable, and Responsive Angular Universal Carousel Library

ngxCarousel is a lightweight, tactile, and responsive library for creating an angular carousel. No dependencies, no more hammer. Must Read: Angular Responsive Image Slider With Lightbox Popup…


First Mobile Full-screen Modal Popup Library For Vue

Vue full-page modal is a responsive, mobile-compatible, screen-friendly pop-up library for Vue.js. Must Read: Modal Component Is Written in Vanilla JS | ensemble Modal How to make…


Generate a Random Number Picker In Vanilla JavaScript

Random Number Picker is a Vanilla JS-based number picker that allows you to generate a random number within a specified range. Must Read: Generating Lottery Numbers Using…