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
$ 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
</div>

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
</div>

Determine whether or not to repeat the animation.

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

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

Set the gap from the top to trigger the animation.

<div data-scroll="your own class"
     data-scroll-repeat="true"
     data-scroll-offset="100"> 
     Element To Animate
</div>

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"
     data-scroll-repeat="true"
     data-scroll-offset="100"
     data-reverse="true"> 
     Element To Animate
</div>

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-party

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…

jquery-cookie-consent

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-Plugin-for-jQuery

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…

angular-ngx-carousel-slider

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…

vue-fullpage-modal

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…

random-number-picker

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…