数据属性中的 data-300-center-center 是什么意思 html

what is the meaning of data-300-center-center in data attribute html

我有以下html

<p data-300-center-top="transform: scale(0.8); opacity: 0" 
   data-300-center-center="transform: scale(1); opacity: 1"> 

我用 skrollr.js

我不明白我在属性 data-*-center-centerdata-*-center-top 中使用数字 300 的目的或原因。

您可以阅读 docs:

The syntax is data-[offset]-[anchor], where offset can be any integer (0 is default) and anchor can be either start (default) or end. Either offset or anchor can be omitted in some situations. Here are some examples of key frames and their meaning.

例如:

data-bottom-center = data-0-bottom-center: When the element's center is at the bottom of the viewport, thus the upper.

所以在你的情况下:

data-300-center-top 表示元素的中心位于视口顶部下方 300px