开发者

How do I create a modal popup like this using Ruby on Rails?

I want to get a modal popup almost like the ones you see when you send a message on Facebook or when you sign up to say the newsletter on www.gemvara.com in my own Ruby on Rails application.

The idea is someone signs up for a newsletter, and I give them a very frien开发者_如何学Godly inline modal popup saying thanks for subscribing, etc.

How do I go about doing that with Ruby on Rails? Do I have to use ActionView? Do I write it in pure JavaScript and not bother doing it in Rails? How do you Rails experts suggest I do this the cleanest way possible using Rails 2.3.8.

I've found plugins that does this in jQuery, does that mean I should load jQuery AND Prototype which is Rails default javascript library of choice? Seems like a waste of network bandwidth to load both.


Modal dialogs are accomplished via JavaScript. Your rails app may provide the data, form, whatever that is displayed in the dialog, but you are doing a lot of the work in JavaScript. I would recommend taking a look @ the jQuery UI project. Here is a link directly to their modal dialog widget: http://jqueryui.com/demos/dialog/

Have fun!


Also, if you're not using jQuery, there is a rails plugin called Redbox, although I haven't used it in a while, but it also lets you create modals, and uses Prototype, in case you're using the default JS libs.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜