Ruby on rails Fancybox宝石导致点击后图片消失?

Ruby on rails Fancybox宝石导致点击后图片消失?,ruby-on-rails,fancybox,Ruby On Rails,Fancybox,我正在尝试使用fancybox,这样我的照片就可以很好地观看。我的问题与相同,但即使在将href添加到我的链接后,它也不起作用 问题是当我点击图片时,fancybox图像查看器弹出,但我网站上的图像消失了 以下是我的代码中不起作用的部分: <% if @album.photos.any? %> <% @album.photos.each do |photo| %> <div class="picthumb"> &

我正在尝试使用fancybox,这样我的照片就可以很好地观看。我的问题与相同,但即使在将href添加到我的链接后,它也不起作用

问题是当我点击图片时,fancybox图像查看器弹出,但我网站上的图像消失了

以下是我的代码中不起作用的部分:

<% if @album.photos.any? %>
    <% @album.photos.each do |photo| %>
        <div class="picthumb">
            <%= link_to image_tag(photo.avatar.url(:small), :class => "fancybox"), "#" %>
        </div>
    <% end %> 
<% else %>
    There are no pics in this album
<% end %>

“fancybox”),“#”%>
此相册中没有图片

有人知道发生了什么吗?

所以我最终找到了答案。这是因为我在图片上使用了fancybox,而不是链接

<% if @album.photos.any? %>
    <% @album.photos.each do |photo| %>
        <div class="picthumb">
            <%= link_to image_tag(photo.avatar.url(:small)), photo.avatar.url , :class => "fancybox" %>
        </div>
    <% end %> 
<% else %>
    There are no pics in this album
<% end %>
$(document).ready(function() {
#before, I had img.fancybox in the element selector instead of a.fancybox
$("a.fancybox").fancybox();
});