0

我正在尝试将视差效果代码转换为在 Rails 3 应用程序上运行。我无法让它运行,所以我想知道我是否正确转换了这段代码。每组的第一行是原始代码。每组的第二行是我的转换。谁能告诉我这是否正确?

<article class="slide" id="showcasing" style="background:   url('backgrounds/landscape.png') repeat-x top center;">
<%= image_tag("backgrounds/landscape.png", :class => "slide", :id => "showcasing", :style => "background: repeat-x top center") %>

<img class="asset left-30 sp600 t120 z1" src="slides/scene1/macbook.png" />
<%= image_tag("slides/scene1/macbook.png", :class => "asset: left-30 sp600 t120 z1") %>

<article class="slide" id="ideas" style="background: url('backgrounds/aqua.jpg') repeat-x top center;">
<%= image_tag("backgrounds/aqua.jpg", :class => "slide", :id => "ideas", :style => "background: url('backgrounds/aqua.jpg') repeat-x top center") %>

<img class="asset left-480 sp600 t260 z1" src="img/slides/scene2/left.png" />
<%= image_tag("slides/scene2/left.png", :class => "asset left-480 sp600 t260 z1") %>

<img class="asset left-210 sp600 t213 z2" src="img/slides/scene2/middle.png" />
<%= image_tag("slides/scene2/middle.png", :class => "asset left-210 sp600 t213 z2") %>

<img class="asset left60 sp600 t260 z1" src="img/slides/scene2/right.png" />
<%= image_tag("slides/scene2/right.png", :class => "asset left60 sp600 t260 z1") %>
4

1 回答 1

0

每个人都有<article>标签是不对的,因为image_tag只有yield<img />标签。您应该使用image_path来生成一个 url 并将其放入style="background: url()"( image_path API )。

其他代码应该是这样的:

<%= image_tag("slides/scene1/macbook.png", :class => "asset left-30 sp600 t120 z1") %>
于 2013-07-12T04:18:51.273 回答