Reputation: 53
I am building a website in which a div needs to slide in from the left to the right when it is scrolled into view. I am using the AOS library to animate it, but it is not working unless I scroll the element into view, and then refresh the tab.
Here's my HTML's head:
<link href="https://unpkg.com/[email protected]/dist/aos.css" rel="stylesheet">
<script src="https://unpkg.com/[email protected]/dist/aos.js"></script>
And my body content:
<div class="aos-item top" data-aos="slide-right">
<h3><em>Header Here</em></h3>
<p>
<big>
Content Here.
</big>
</p>
</div>
<script>
AOS.init();
</script>
Is there something wrong with my code? Or is it the library? If it is the library, are there any good alternatives?
Upvotes: 4
Views: 2813