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)
load script in your HTML page.
//scrollyaan script file
<script src="file_location/scrollyaan.min.js"></script>
scrollyaan currently have two option's
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. |
for adding a location at which callback should be fire.
scrollyaan.atIndex(pixels , callback);
pixels | a number which define distance in pixel from top of the whole page(not viewport). |
callback | a callback function |