scrollreveal README

The project's README from github.com/jlmakes/scrollreveal. As one markdown file: README.md.

ScrollReveal


ScrollReveal

Animate elements as they scroll into view.

Build status Monthly downloads Version 5.7 kB min+gzip GPLv3 License


Installation

Browser

A simple and fast way to get started is to include this script on your page:

<script src="https://unpkg.com/scrollreveal"></script>

This will create the global variable ScrollReveal

Be careful using this method in production. Without specifying a fixed version number, Unpkg may delay your page load while it resolves the latest version. Learn more at unpkg.com

Module

$ npm install scrollreveal

CommonJS

const ScrollReveal = require('scrollreveal')

ES2015

import ScrollReveal from 'scrollreveal'

Usage

Installation provides us with the constructor function ScrollReveal(). Calling this function returns the ScrollReveal instance, the “brain” behind the magic.

ScrollReveal employs the singleton pattern; no matter how many times the constructor is called, it will always return the same instance. This means we can call it anywhere, worry-free.

There’s a lot we can do with this instance, but most of the time we’ll be using the reveal() method to create animation. Fundamentally, this is how to use ScrollReveal:

<h1 class="headline">
	Widget Inc.
</h1>
ScrollReveal().reveal('.headline')

🔎 See this demo live on JSBin



The full documentation can be found at https://scrollrevealjs.org

If you’re using an older version of ScrollReveal, you can find legacy documentation in the wiki



Commercial License Badge

License

For commercial sites, themes, projects, and applications, keep your source code private/proprietary by purchasing a Commercial License.

Licensed under the GNU General Public License 3.0 for compatible open source projects and non-commercial use.


Copyright 2023 Fisssion LLC

scrollreveal (jlmakes/scrollreveal)

Searching Database…

这是什么东西?ScrollReveal 是一个 JavaScript 库,能让网页元素在滚动进入视野时产生动画效果。
它是一个独立的应用,还是要加到我自己的页面代码里的东西?它是一个引入到网页里的小型 JavaScript 库——既可以通过 script 标签引入,也可以作为模块导入——并不是一个独立的应用程序。
怎么把它加到页面上?可以引入来自 unpkg 的脚本,这会创建一个全局的 ScrollReveal 变量;也可以通过 npm 安装,再以 CommonJS 或 ES2015 模块的方式导入。
用 script 标签这种方式放在正式环境里安全吗?要小心使用:如果不固定版本号,unpkg 在解析最新版本时可能会拖慢页面加载速度,所以在正式环境里请锁定一个具体版本。
用在商业网站上需要付费吗?如果想让自己的代码保持闭源,那就需要付费购买商业许可证(Commercial License)。开源项目和非商业用途则可以免费使用,适用 GPLv3。
多次调用 ScrollReveal() 会创建多个实例吗?不会。ScrollReveal 采用单例模式——无论构造函数被调用多少次,返回的始终是同一个实例,所以在任何地方调用都不会冲突。
这些动画是基于什么实现的?它们基于 CSS transform 和 transition 实现。库内部还自带几个很小的辅助依赖:rematrix、tealight 和 miniraf。
这个项目还在维护吗?它从 2014 年就存在了,在 GitHub 上有超过 22k 颗星,没有被归档;README 中的版权信息为 2023 年,归属 Fisssion LLC。
What are similar projects?GSAP, lax.js, isotope, motion, iscroll, toastr, headroom.js, anime
Creator
jlmakes
Size
1.1 MB
Stars
22.5K
Updated
CommitMar 18
Age
12y
Commits · 90 Days