Make links open in lightbox (colorbox) a breeze
- Rails 4.0
- colorbox js v. 1.6.4
in your application.css
*= require colorbox-rails
in your application.js
//= require colorbox-rails
Then enable link to be displayed in colorbox by simply adding :colorbox => true attribute. E.g.
<%= link_to "My superb link", "#", :data => { :colorbox => true } %>
Add attributes inside the :data block
<%= link_to "My superb link", "#", :data => { :colorbox => true, :colorbox_height => '300px', :colorbox_width => '300px', :colorbox_iframe => true } %>
- colorbox-height (http://www.jacklmoore.com/colorbox/#setting-height)
- colorbox-width (http://www.jacklmoore.com/colorbox/#setting-width)
- colorbox-max-height (http://www.jacklmoore.com/colorbox/#setting-maxHeight)
- colorbox-max-width (http://www.jacklmoore.com/colorbox/#setting-maxWidth)
- colorbox-iframe (http://www.jacklmoore.com/colorbox/#setting-iframe)
- colorbox-photo (http://www.jacklmoore.com/colorbox/#setting-photo)
- colorbox-innerheight (http://www.jacklmoore.com/colorbox/#setting-innerheight)
- colorbox-innerwidth (http://www.jacklmoore.com/colorbox/#setting-innerwidth)
- colorbox-title (http://www.jacklmoore.com/colorbox/#setting-title)
- colorbox-class-name (http://www.jacklmoore.com/colorbox/#setting-className)
- colorbox-href (http://www.jacklmoore.com/colorbox/#setting-href)
- colorbox-html (http://www.jacklmoore.com/colorbox/#setting-html)
- rel (need colorbox-static data-attribute to work) (http://www.jacklmoore.com/colorbox/#setting-rel)
<%= link_to "My superb link", "#", rel: 'group1', :data => { :colorbox_static => true } %>
This project rocks and uses MIT-LICENSE.