Make links open in lightbox (colorbox) a breeze
in your application.css
//= require colorbox-rails
in your application.js
//= require colorbox-rails
Then enable links to be controlled by colorbox by simply adding a :colorbox => ‘true’ data attribute to the link. E.g.: <%= link_to "My superb link", "#", :data => { :colorbox => 'true' } %>
Outputs the HTML: <a href="#" data-colorbox="true">My superb link</a>
Add attributes inside the :data block: <%= link_to "My superb link", "#", :data => { :colorbox => true, :colorbox_height => '300px', :colorbox_width => '300px', :colorbox_iframe => true } %>
If you are adding links dynamically with Javascript, and want them to be colorbox’d, use :colorbox => ‘live’: <%= link_to "My superb link", "#", :data => { :colorbox => 'live' } %>
Note that the “live” method does not allow for grouping (rel=“photo_group”).
This project rocks and uses MIT-LICENSE.