I want to animate div only when div is visible on viewport using https://animate.style/
At this point it animates div even when its not in viewport which is normal behavior of animation library i am using, but i want animation to start when div with class .box
is in viewport . I added delay but that is not practical as i am not sure when user will scroll to that part of webpage which needs to be animate
<div class="box animate__animated animate__fadeInLeft animate__delay-2s"><span>50 Years of Excellence and Beyond</span></div>
Is there a way i can start animate only when div is in viewport as i don't want to use JS
Codepen: https://codepen.io/KGuide/pen/MWQaQWm
.main{width:800px; height:250vh; background:blue; display:flex; align-items: flex-start; margin:auto auto;}
.box {width:300px; height:300px; bottom::0; background:red; align-self: center;}
<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" rel="stylesheet"/>
<div class="main">
<div class="box animate__animated animate__fadeInLeft animate__delay-3s"><span>50 Years of Excellence and Beyond</span></div>
</div>