
inView.js is a pure JavaScript library that watches for the scroll event and executes callbacks when an element is scrolled in or out of the viewport.
How to use it:
Just load the inView.js JavaScript file into your html document and we’re ready to go.
<script src="inView.js"></script>
Add the CSS class ‘inView’ to your element.
<img class="inView" src="1.jpg">
Execute callback functions if the image is scrolled into or out of the viewport.
var el = new inView(document.getElementById('inView'));
el.onInView(function() {
// do something
});
el.onOutView(function() {
// do something
});






