【发布时间】:2015-02-07 16:22:04
【问题描述】:
我在页面上有一个视频网格,点击后会在灯箱中弹出。如果用户将鼠标悬停在网格图像上,我希望显示视频的标题。
现在,在悬停时,我得到了所需的标题背景,但我不知道在哪里/如何将视频标题的 css 属性放在我的 html.erb 中
这是 CSS:
.masonry:hover .item.w2:hover:after {
content: attr(datatitle);
display: block;
text-align: center;
background-color: #333;
color: #fff;
padding: 5px;
width: 250px;
height: 40px;
opacity:0.5;
position: absolute;
top: 0px;
}
这是我的看法:
<div class="item w2" ><%= link_to image_tag(Video.find(19).image_url, size: "250x141"), Video.find(19).player_embed_url, class: "fancybox fancybox.iframe"%>
我在哪里放置 datatitle 属性以及如何放置?我想用上面相同的方法提取视频的标题(即 Video.find(19).title)
作为参考,这是我用来制作这个的 jsfiddle:
http://jsfiddle.net/arthurcamara/chbsL3pq/
但显然,我想从 Video 对象中提取 Title,而不是硬编码。
【问题讨论】:
标签: jquery html css ruby-on-rails