Add animations to a webpage, triggered when scrolling
First, load css/vanilla-scrollanims.css & js/vanilla-scrollanims.js in your webpage.
Then, when DOM is ready, start the plugin :
// Find elements
var scrollItems = document.querySelectorAll('.will-scrollanim');
// Trigger plugin
var scrollAnim = new dkJSUScrollAnims(scrollItems, {});
<img class="has-scrollanim" data-delay="500" src="images/image-1.jpg" alt="" />
<img class="has-scrollanim" data-offset="-100" src="images/image-1.jpg" alt="" />
<div class="has-scrollanim" data-usechildren="1" data-delay="100">
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
</div>
<div class="has-scrollanim" data-childselector="img" data-usechildren="1" data-delay="100">
<p>
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
<img src="images/image-1.jpg" alt="" />
</p>
</div>
document.getElementById('has-scrollanim-element').addEventListener('activescrollanim',function(){
alert('Scroll has reached this element.');
});