Currently, I am working on a Vue project and I am looking to implement an effect or add a class to a specific div when the user scrolls to it. This functionality is similar to what can be achieved with ScrollReveal.
Has anyone encountered this scenario before while working with Vue?
Below is the CSS code that I have, which needs to be triggered when the specified div comes into view:
The title effect on h2 should take place when it becomes visible on the screen.
@keyframes slideInFromLeft {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(0);
}
}
h1 {
animation: 1s ease-out 0s 1 slideInFromLeft;
}
h2 {
animation: 1s ease-out 0s 1 slideInFromLeft;
}
<h1>
Hello World!
</h1>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<h2>
World Hello!
</h2>