什么是垂直降低HTML中一组文本段落中的不透明度的简洁方法

rog*_*oom 2 html javascript css jquery ruby-on-rails

我正在使用rails编写应用程序.我有多段动态文本垂直列出.

我正在通过javascript或CSS看整齐的方式来垂直增加段落组的不透明度,这样当你走下页面时,文本正文就会消失.

<p>Some text obviously more than i am writing here</p>   ||
<p>Some text obviously more than i am writing here</p>   || increase opacity
<p>Some text obviously more than i am writing here</p>   \/
Run Code Online (Sandbox Code Playgroud)

1. /什么是垂直和水平定相一段的标准方法?

2. /我如何分组?

Mar*_*rko 5

这可能是一个好的开始?

var increment = 10;
$("p").each(function(index, value) {
   $(this).fadeTo("slow", (increment*index)/100);
});
Run Code Online (Sandbox Code Playgroud)

在这里玩一玩.

您只需编辑"增量"变量即可更改不透明度增量.