开发者

How to set up a lightbox in Ruby on Rails?

I am running Ruby on Rails 3 and I would like to use开发者_StackOverflow中文版 a lightbox in my application, for example to show a login form and sign in users. I would like to use the Prototype framework.

How is that possible? Do you have any advice or alert on this?

P.S.: I would like to write as much as possible my proprietary code. Is that advisable?


In my opinion the best lightbox are:

For prototype - Lightview - http://www.nickstakenburg.com/projects/lightview/

For jQuery - Facebox - http://chriswanstrath.com/facebox/


not really specific to Rails but you'll want to use something like http://fancybox.net/ which makes use of JQuery. There are examples at the bottom for what you want to achieve which is a modal window. You'll need a view in your application that you'll load into the modal window - remember to not have an application layout on it otherwise you will have double layouts.

There are plenty of libraries out there that are tried and tested so unless there's a reason for not making use of them then I'd suggest using them rather than reinventing the wheel.


http://blog.philburrows.com/articles/2008/05/05/porting-facebox-from-jquery-to-prototype/

facebox rewritten for prototype.

i use the jquery version on my site. i changed the theme and removed a lot of stuff to simplify facebox but it's a good lightbox as is. quite good.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜