shubhendrapatel / Scrollyaan

Scrollyaan is a pure JavaScript library for firing callbacks when either element appear on Viewport or reached to particular scroll position.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

scrollyaan

Scrollyaan is a lightweight script for firing callback when -

  • A HTML element appear on screen/ viewport.
  • the user has scrolled particular pixels.(currently, support only in Y direction)

Usage

load script in your HTML page.

//scrollyaan script file
<script src="file_location/scrollyaan.min.js"></script>

options

scrollyaan currently have two option's

inViewport

inViewport is a function, For any element of which a callback should be fire when appearing in screen or viewport.

scrollyaan.inViewport(element , callback , offset , iteration );
element a valid dom element or target.
callback a callback function.
offset a number between 1 to 100 which define distance in parcentage from top of viewport.
iteration a boolean value which define callback should be fire each it appear on viewport or not.

atIndex

for adding a location at which callback should be fire.

scrollyaan.atIndex(pixels , callback);
pixelsa number which define distance in pixel from top of the whole page(not viewport).
callback a callback function

About

Scrollyaan is a pure JavaScript library for firing callbacks when either element appear on Viewport or reached to particular scroll position.

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%