?-6ren"> ?-我有一个图像 uploader ,可以将示例封面图片添加到包含行 .图像在自己的标签中呈现,带有 class=”rotation”,如 .我还需要在 “rotation” 之间交替上课和 “rot-6ren">
gpt4 book ai didi

jquery - 在应用程序的 .erb View 中交替使用 rails image_uploader.rb 生成

转载 作者:行者123 更新时间:2023-11-28 07:42:35 26 4
gpt4 key购买 nike

我有一个图像 uploader ,可以将示例封面图片添加到包含行 <div class=”row”> .图像在自己的标签中呈现,带有 class=”rotation”,如 <div class=”rotation”> .我还需要在 “rotation” 之间交替上课和 “rotation-alt”为了使用 CSS 应用交替旋转。如何在 rails .erb View 中交替渲染每个上传的标签?

.erb 目前看起来像这样:

  <%= link_to "Upload New Photo", new_cover_path, class: "btn" %>

<div class="row">
<% @covers.each do |cover| %>

<div class="rotation">
<%= link_to image_tag(cover.photo.url(:thumb), :class => 'img-responsive'), image_path(cover.photo.url), :class => 'thumbnail' if cover.photo? %>
</div>

<% end %>

感谢您的帮助。

最佳答案

使用循环方法

例如:

class="<%= cycle("rotation", "rotation_alt", name: "row_class") -%>"

关于jquery - 在应用程序的 .erb View 中交替使用 rails image_uploader.rb 生成 <div class ="one/other">?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30883146/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com