我是Rails的新手,我正在尝试制作一些简单的图片库,也许有人可以给我一些建议。我正在查找Bootstap中的modal之类的东西。
我现在有这样的东西
<article class="thumbnail">
<a href="#myModal" role="button" class="btn" data-toggle="modal"><img src="/assets/project1.png" alt="Project1" /></a>
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><img src="/assets/project1.png" alt="Project1" /></h3>
</div>
<div class="modal-footer">
<a class="btn btn-info modal-prev"> Previous</a>
<a class="btn btn-primary modal-next">Next <i class="icon-arrow-right icon-white"></i></a>
</div>
</div>
</article>
我在想如何让我的模式页脚工作。
发布于 2013-07-02 16:57:35
嗯,如果你正在寻找客户端实现,我推荐使用Fancybox:http://fancyapps.com/fancybox/这个库功能强大,但很容易使用。
如果您正在寻找滚动条,请尝试使用FlexSlider:https://github.com/woothemes/FlexSlider
更新
这是一个如何在rails应用程序中使用Fancybox来显示照片(取自我的工作应用程序)的示例:
在javascript文件夹中有两个文件: jquery.fancybox.pack.js和jquery.fancybox-buttons.js (因为我还需要为我的图库使用控制按钮)。我也有MouseWheel库,但这个是可选的。在application.js中(当然,您可以有其他库):
//= require jquery
//= require jquery_ujs
//= require jquery.ui.all
//= require lib/jquery.mousewheel
//= require lib/jquery.fancybox.pack
//= require lib/jquery.fancybox-buttons
jQuery(function($) { // as soon as DOM is ready
$(".fancybox").fancybox({ // initialize fancybox on all pages where it is present
helpers: {
title: {type: 'inside'},
buttons: {}
}
});
});
另外,不要忘记下载FancyBox样式并将其包含在您的application.css中。
在我看来:
<% photos.each do |photo| %>
<%= link_to image_tag(photo.file.thumb('200x200#').url),
photo.file.remote_url,
class: 'fancybox', rel: 'group', title: photo.title, alt: 'Photo' %>
<% end %>
https://stackoverflow.com/questions/17421089
复制相似问题