Reputation: 134
I installed colorbox-rails gem for a Rails 4 project. Everything seems to work but only after I refresh the page.
Installation
Code
<%= link_to image_tag(photo.image.url, class: 'img-thumbnail'), photo.image.remote_url, rel: 'gallery', :data => { :colorbox_static => true, colorbox_photo: true}, target: '_blank' %>
Upvotes: 1
Views: 386
Reputation: 3782
"Only works on refresh" is a common issue for people using Turbolinks, because it changes which Javascript events get fired on a page change. There's a few things to try, assuming this is the issue:
no_turbolink: true
to the data
hash.More information on turbolinks here if you need it.
Upvotes: 1