fade('.js-fade');
function fade(elm) {
var aniamtionClass = 'is-show';
var controller = new ScrollMagic.Controller();
var targets = document.querySelectorAll(elm + ':not(.is-show)');
if(targets.length < 1) return;
for (var i = 0; i < targets.length; i++) {
targets[i].classList.add('fade-' + i);
var scene = new ScrollMagic.Scene({
triggerElement: '.fade-' + i,
triggerHook: 'onEnter',
reverse: false,
offset: 100
})
.setClassToggle('.fade-' + i, 'is-show')
//.addIndicators()
.addTo(controller);
}
}