本文介绍了Facebox Rails应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在知道已经安装了jquery-rails gem的情况下,如何在Rails应用程序中使用facebox?还需要进入视图的示例代码.谢谢.

how do I use facebox in a Rails app knowing that I already have the jquery-rails gem installed? Need sample code that goes into the view as well. Thanks.

推荐答案

将facebox库包含在application.html.erb文件中.

Include facebox library in your application.html.erb file.

将此代码添加到javascript文件中.

Add this code in a javascript file.

jQuery(document).ready(function($) {
  $('a[rel*=facebox]').facebox() 
})

查看

<a href="images/stairs.jpg" rel="facebox">text</a>

在他们的网站上有一些简单的示例和一些文档 https://github.com/defunkt/facebox#usage .

There are a few simple examples and some documentation on their site https://github.com/defunkt/facebox#usage.

这篇关于Facebox Rails应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 23:23