📅  最后修改于: 2023-12-03 14:59:19.800000             🧑  作者: Mango
AOS (Animate on Scroll) is a JavaScript library that allows you to animate elements as you scroll down the page. It works by adding classes to the elements based on the direction and position of the user's scroll. This library is lightweight, easy to use, and customizable.
You can install AOS via npm or simply download the script and include it in your HTML file:
<head>
...
<link rel="stylesheet" href="path/to/aos.css" />
...
</head>
<body>
...
<script src="path/to/aos.js"></script>
</body>
data-aos
attribute to the element you want to animate:<h1 data-aos="fade-up">Hello, World!</h1>
AOS.init();
init
method:AOS.init({
duration: 800,
easing: 'ease-in-out',
once: true
});
<div data-aos="fade"></div>
<div data-aos="zoom-in"></div>
<div data-aos="slide-left"></div>
<div data-aos="flip-right"></div>
AOS is a powerful and versatile tool to add animation effects to your website. Its lightweight size and easy-to-use interface make it accessible for developers of all levels. Use it to enhance your website's user experience and make your pages more engaging and dynamic.