作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个图像 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/
我是一名优秀的程序员,十分优秀!