Viewability Management lets you play a creative’s animation only when it’s visible. To implement this solution, we must manage the visibility event in the banner and execute the animation when the event is captured.
The ADventori.isVisible
method lets you know if the banner is visible.
ADventori.Event.addEventListenerOnce(ADventori.Event.VISIBLE,callBackFunction);
this method subscribes to the visibility event and calls the parameter function when it is visible.
In the case below the function startAnimation will be called when the banner will be visible:
if(!ADventori.isVisible()){
ADventori.Event.addEventListenerOnce(ADventori.Event.VISIBLE,startAnimation);
}else{
startAnimation();
}
function startAnimation() {
//Write your animation's code here
}