[英]Fancybox not working in Rails 3.1
I'm using gem 'fancybox-rails'
我正在使用
gem 'fancybox-rails'
Here is what my html is like (I'm trying to display the hidden div with class item_comments
): 这是我的html的样子(我正在尝试使用class
item_comments
显示隐藏的div):
<div class="details">
<ul class="items">
<li><a class="comments" href="#">show comments</a></li>
</ul>
<div class="item_comments">
<ul>
<% comments.each do |comment| %>
<li><%= comment.comment %></li>
<% end %>
</ul>
</div>
</div>
Here is my JS for this: 这是我的JS:
$(".comments").click(function(e) {
e.preventDefault();
$(this).parent().parent().parent().find('.item_comments').fancybox();
return false;
});
PS. PS。 I've tried manually including fancy box js, css and images also -- still won't work :(
我已经尝试过手动包括花哨的盒子js,css和图像-仍然行不通:(
I'm not sure if this is the problem, but you don't have a tag in the "show comments" link. 我不确定这是否是问题所在,但“显示评论”链接中没有标签。 Because of that, your .parent() functions might not be working.
因此,您的.parent()函数可能无法正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.